mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-18 22:40:04 +00:00
Implement host processing time in stats overlay
This commit is contained in:
@@ -17,6 +17,10 @@ typedef struct {
|
|||||||
int totalFrames;
|
int totalFrames;
|
||||||
int receivedFrames;
|
int receivedFrames;
|
||||||
int networkDroppedFrames;
|
int networkDroppedFrames;
|
||||||
|
int totalHostProcessingLatency;
|
||||||
|
int framesWithHostProcessingLatency;
|
||||||
|
int maxHostProcessingLatency;
|
||||||
|
int minHostProcessingLatency;
|
||||||
} video_stats_t;
|
} video_stats_t;
|
||||||
|
|
||||||
@interface Connection : NSOperation <NSStreamDelegate>
|
@interface Connection : NSOperation <NSStreamDelegate>
|
||||||
|
|||||||
@@ -143,6 +143,19 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit)
|
|||||||
lastFrameNumber = decodeUnit->frameNumber;
|
lastFrameNumber = decodeUnit->frameNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decodeUnit->frameHostProcessingLatency != 0) {
|
||||||
|
if (currentVideoStats.minHostProcessingLatency == 0 || decodeUnit->frameHostProcessingLatency < currentVideoStats.minHostProcessingLatency) {
|
||||||
|
currentVideoStats.minHostProcessingLatency = decodeUnit->frameHostProcessingLatency;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (decodeUnit->frameHostProcessingLatency > currentVideoStats.maxHostProcessingLatency) {
|
||||||
|
currentVideoStats.maxHostProcessingLatency = decodeUnit->frameHostProcessingLatency;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentVideoStats.framesWithHostProcessingLatency++;
|
||||||
|
currentVideoStats.totalHostProcessingLatency += decodeUnit->frameHostProcessingLatency;
|
||||||
|
}
|
||||||
|
|
||||||
currentVideoStats.receivedFrames++;
|
currentVideoStats.receivedFrames++;
|
||||||
currentVideoStats.totalFrames++;
|
currentVideoStats.totalFrames++;
|
||||||
|
|
||||||
|
|||||||
@@ -167,14 +167,26 @@
|
|||||||
latencyString = @"N/A";
|
latencyString = @"N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSString* hostProcessingString;
|
||||||
|
if (stats.framesWithHostProcessingLatency != 0) {
|
||||||
|
hostProcessingString = [NSString stringWithFormat:@"\nHost processing latency min/max/avg: %.1f/%.1f/%.1f ms",
|
||||||
|
stats.minHostProcessingLatency / 10.f,
|
||||||
|
stats.maxHostProcessingLatency / 10.f,
|
||||||
|
(float)stats.totalHostProcessingLatency / stats.framesWithHostProcessingLatency / 10.f];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hostProcessingString = @"";
|
||||||
|
}
|
||||||
|
|
||||||
float interval = stats.endTime - stats.startTime;
|
float interval = stats.endTime - stats.startTime;
|
||||||
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\nFrames dropped by your network connection: %.2f%%\nAverage network latency: %@",
|
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\nFrames dropped by your network connection: %.2f%%\nAverage network latency: %@%@",
|
||||||
_config.width,
|
_config.width,
|
||||||
_config.height,
|
_config.height,
|
||||||
stats.totalFrames / interval,
|
stats.totalFrames / interval,
|
||||||
[_connection getActiveCodecName],
|
[_connection getActiveCodecName],
|
||||||
stats.networkDroppedFrames / interval,
|
stats.networkDroppedFrames / interval,
|
||||||
latencyString];
|
latencyString,
|
||||||
|
hostProcessingString];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user