From 390544cd9a369582ad6a4c747b6c3380bbe03afe Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 31 Dec 2020 16:10:01 -0600 Subject: [PATCH] Charge time spent in the decode unit queue to the decoder rather than receive time --- app/streaming/video/ffmpeg.cpp | 9 ++++----- moonlight-common-c/moonlight-common-c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 7f0124bb..6b5716cd 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -891,9 +891,7 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du) m_Pkt.flags = 0; } - m_ActiveWndVideoStats.totalReassemblyTime += LiGetMillis() - du->receiveTimeMs; - - Uint32 beforeDecode = SDL_GetTicks(); + m_ActiveWndVideoStats.totalReassemblyTime += du->enqueueTimeMs - du->receiveTimeMs; err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt); if (err < 0) { @@ -945,8 +943,9 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du) frame->pkt_dts = SDL_GetTicks(); // Count time in avcodec_send_packet() and avcodec_receive_frame() - // as time spent decoding - m_ActiveWndVideoStats.totalDecodeTime += SDL_GetTicks() - beforeDecode; + // as time spent decoding. Also count time spent in the decode unit + // queue because that's directly caused by decoder latency. + m_ActiveWndVideoStats.totalDecodeTime += LiGetMillis() - du->enqueueTimeMs; // Also count the frame-to-frame delay if the decoder is delaying frames // until a subsequent frame is submitted. diff --git a/moonlight-common-c/moonlight-common-c b/moonlight-common-c/moonlight-common-c index 3aa24638..fd950b64 160000 --- a/moonlight-common-c/moonlight-common-c +++ b/moonlight-common-c/moonlight-common-c @@ -1 +1 @@ -Subproject commit 3aa246385680454c8564d28ca3a8807eb4f56195 +Subproject commit fd950b64528ce6ca6cf5d24d93418f1dda8bd0ca