mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-18 14:40:56 +00:00
Add host processing latency to ffmpeg stats overlay
This commit is contained in:
@@ -15,6 +15,10 @@ typedef struct _VIDEO_STATS {
|
|||||||
uint32_t totalFrames;
|
uint32_t totalFrames;
|
||||||
uint32_t networkDroppedFrames;
|
uint32_t networkDroppedFrames;
|
||||||
uint32_t pacerDroppedFrames;
|
uint32_t pacerDroppedFrames;
|
||||||
|
uint16_t minHostProcessingLatency;
|
||||||
|
uint16_t maxHostProcessingLatency;
|
||||||
|
uint32_t totalHostProcessingLatency;
|
||||||
|
uint32_t framesWithHostProcessingLatency;
|
||||||
uint32_t totalReassemblyTime;
|
uint32_t totalReassemblyTime;
|
||||||
uint32_t totalDecodeTime;
|
uint32_t totalDecodeTime;
|
||||||
uint32_t totalPacerTime;
|
uint32_t totalPacerTime;
|
||||||
|
|||||||
@@ -565,6 +565,16 @@ void FFmpegVideoDecoder::addVideoStats(VIDEO_STATS& src, VIDEO_STATS& dst)
|
|||||||
dst.totalPacerTime += src.totalPacerTime;
|
dst.totalPacerTime += src.totalPacerTime;
|
||||||
dst.totalRenderTime += src.totalRenderTime;
|
dst.totalRenderTime += src.totalRenderTime;
|
||||||
|
|
||||||
|
if (dst.minHostProcessingLatency == 0) {
|
||||||
|
dst.minHostProcessingLatency = src.minHostProcessingLatency;
|
||||||
|
}
|
||||||
|
else if (src.minHostProcessingLatency != 0) {
|
||||||
|
dst.minHostProcessingLatency = qMin(dst.minHostProcessingLatency, src.minHostProcessingLatency);
|
||||||
|
}
|
||||||
|
dst.maxHostProcessingLatency = qMax(dst.maxHostProcessingLatency, src.maxHostProcessingLatency);
|
||||||
|
dst.totalHostProcessingLatency += src.totalHostProcessingLatency;
|
||||||
|
dst.framesWithHostProcessingLatency += src.framesWithHostProcessingLatency;
|
||||||
|
|
||||||
if (!LiGetEstimatedRttInfo(&dst.lastRtt, &dst.lastRttVariance)) {
|
if (!LiGetEstimatedRttInfo(&dst.lastRtt, &dst.lastRttVariance)) {
|
||||||
dst.lastRtt = 0;
|
dst.lastRtt = 0;
|
||||||
dst.lastRttVariance = 0;
|
dst.lastRttVariance = 0;
|
||||||
@@ -656,6 +666,14 @@ void FFmpegVideoDecoder::stringifyVideoStats(VIDEO_STATS& stats, char* output)
|
|||||||
stats.renderedFps);
|
stats.renderedFps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stats.framesWithHostProcessingLatency > 0) {
|
||||||
|
offset += sprintf(&output[offset],
|
||||||
|
"Host processing latency min/max/average: %.1f/%.1f/%.1f ms\n",
|
||||||
|
(float)stats.minHostProcessingLatency / 10,
|
||||||
|
(float)stats.maxHostProcessingLatency / 10,
|
||||||
|
(float)stats.totalHostProcessingLatency / 10 / stats.framesWithHostProcessingLatency);
|
||||||
|
}
|
||||||
|
|
||||||
if (stats.renderedFrames != 0) {
|
if (stats.renderedFrames != 0) {
|
||||||
char rttString[32];
|
char rttString[32];
|
||||||
|
|
||||||
@@ -1367,6 +1385,18 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||||||
m_ActiveWndVideoStats.measurementStartTimestamp = SDL_GetTicks();
|
m_ActiveWndVideoStats.measurementStartTimestamp = SDL_GetTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (du->frameHostProcessingLatency != 0) {
|
||||||
|
if (m_ActiveWndVideoStats.minHostProcessingLatency != 0) {
|
||||||
|
m_ActiveWndVideoStats.minHostProcessingLatency = qMin(m_ActiveWndVideoStats.minHostProcessingLatency, du->frameHostProcessingLatency);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_ActiveWndVideoStats.minHostProcessingLatency = du->frameHostProcessingLatency;
|
||||||
|
}
|
||||||
|
m_ActiveWndVideoStats.framesWithHostProcessingLatency += 1;
|
||||||
|
}
|
||||||
|
m_ActiveWndVideoStats.maxHostProcessingLatency = qMax(m_ActiveWndVideoStats.maxHostProcessingLatency, du->frameHostProcessingLatency);
|
||||||
|
m_ActiveWndVideoStats.totalHostProcessingLatency += du->frameHostProcessingLatency;
|
||||||
|
|
||||||
m_ActiveWndVideoStats.receivedFrames++;
|
m_ActiveWndVideoStats.receivedFrames++;
|
||||||
m_ActiveWndVideoStats.totalFrames++;
|
m_ActiveWndVideoStats.totalFrames++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user