Add a basic stats overlay

This commit is contained in:
Cameron Gutman
2020-11-01 13:27:10 -06:00
parent 2114e39237
commit 44f713f5c9
5 changed files with 125 additions and 1 deletions
+21
View File
@@ -130,4 +130,25 @@
return TRUE;
}
- (NSString*) getStatsOverlayText {
video_stats_t stats;
if (!_connection) {
return nil;
}
if (![_connection getVideoStats:&stats]) {
return nil;
}
float interval = stats.endTime - stats.startTime;
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\nIncoming frame rate from network: %.2f FPS\nFrames dropped by your network connection: %.2f%%\n",
_config.width,
_config.height,
stats.totalFrames / interval,
[_connection getActiveCodecName],
stats.receivedFrames / interval,
stats.networkDroppedFrames / interval];
}
@end