fix: overlay level hanling
This commit is contained in:
1 parent
5e4ba088be
commit
8126173128
3 files changed
+31
-24
No files matched your search
@@ -20,6 +20,6 @@
|
||||
|
||||
- (void) stopStream;
|
||||
|
||||
- (NSString*) getStatsOverlayText;
|
||||
- (NSString*) getStatsOverlayText: (uint16_t) overlayLevel;
|
||||
|
||||
@end
|
||||
@@ -154,7 +154,7 @@
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
- (NSString*) getStatsOverlayText {
|
||||
- (NSString*) getStatsOverlayText: (uint16_t) overlayLevel {
|
||||
video_stats_t stats;
|
||||
|
||||
if (!_connection) {
|
||||
@@ -168,7 +168,7 @@
|
||||
uint32_t rtt, variance;
|
||||
NSString* latencyString;
|
||||
if (LiGetEstimatedRttInfo(&rtt, &variance)) {
|
||||
latencyString = [NSString stringWithFormat:@"%u ms (variance: %u ms)", rtt, variance];
|
||||
latencyString = [LocalizationHelper localizedStringForKey:@"%u ms (variance: %u ms)", rtt, variance];
|
||||
}
|
||||
else {
|
||||
latencyString = @"N/A";
|
||||
@@ -176,7 +176,7 @@
|
||||
|
||||
NSString* hostProcessingString;
|
||||
if (stats.framesWithHostProcessingLatency != 0) {
|
||||
hostProcessingString = [NSString stringWithFormat:@"Host processing latency min/max/avg: %.1f/%.1f/%.1f ms\n",
|
||||
hostProcessingString = [LocalizationHelper localizedStringForKey:@"Host processing latency min/max/avg: %.1f/%.1f/%.1f ms\n",
|
||||
stats.minHostProcessingLatency / 10.f,
|
||||
stats.maxHostProcessingLatency / 10.f,
|
||||
(float)stats.totalHostProcessingLatency / stats.framesWithHostProcessingLatency / 10.f];
|
||||
@@ -192,25 +192,29 @@
|
||||
|
||||
double avgVideoMbps = [_connection getBwTracker].averageMbps;
|
||||
double peakVideoMbps = [_connection getBwTracker].peakMbps;
|
||||
|
||||
return [NSString stringWithFormat:@"Video stream: %dx%d %.2f FPS (Codec: %@)\n"
|
||||
"Bitrate: %.1f Mbps, Peak: %.1f, Renderer: %@\n"
|
||||
"%@"
|
||||
"Frames buffered: %.1f, Present \n"
|
||||
"Frames dropped by network/pacing jitter: %.1f%% / %.1f%%\n"
|
||||
"Average network latency: %@\n"
|
||||
"Decode time: %.2f/%.2f/%.2f ms",
|
||||
_config.width,
|
||||
_config.height,
|
||||
fps,
|
||||
[_connection getActiveCodecName],
|
||||
avgVideoMbps, peakVideoMbps, (stats.renderingBackend == RENDER_METAL) ? @"Metal" : @"AVSampleBuffer",
|
||||
hostProcessingString,
|
||||
stats.frameQueueMetrics.avg,
|
||||
(stats.networkDroppedFrames / stats.totalFrames) * 100.0,
|
||||
stats.frameDropMetrics.nsamples > 0 ? (stats.frameDropMetrics.total / stats.frameDropMetrics.nsamples) * 100.0 : 0.0f,
|
||||
latencyString,
|
||||
stats.decodeMetrics.min, stats.decodeMetrics.max, stats.decodeMetrics.avg];
|
||||
|
||||
if(overlayLevel == 1) return [LocalizationHelper localizedStringForKey:@"FPS: %5.2f Network dropped frames: %.2f%% Network latency: %@",
|
||||
stats.totalFrames / interval,
|
||||
stats.networkDroppedFrames / interval,
|
||||
latencyString];
|
||||
else return [LocalizationHelper localizedStringForKey:@"Video stream: %dx%d %.2f FPS (Codec: %@)\n"
|
||||
"Bitrate: %.1f Mbps, Peak: %.1f, Renderer: %@\n"
|
||||
"%@"
|
||||
"Frames buffered: %.1f, Present \n"
|
||||
"Frames dropped by network/pacing jitter: %.1f%% / %.1f%%\n"
|
||||
"Average network latency: %@\n"
|
||||
"Decode time: %.2f/%.2f/%.2f ms",
|
||||
_config.width,
|
||||
_config.height,
|
||||
fps,
|
||||
[_connection getActiveCodecName],
|
||||
avgVideoMbps, peakVideoMbps, (stats.renderingBackend == RENDER_METAL) ? @"Metal" : @"AVSampleBuffer",
|
||||
hostProcessingString,
|
||||
stats.frameQueueMetrics.avg,
|
||||
(stats.networkDroppedFrames / stats.totalFrames) * 100.0,
|
||||
stats.frameDropMetrics.nsamples > 0 ? (stats.frameDropMetrics.total / stats.frameDropMetrics.nsamples) * 100.0 : 0.0f,
|
||||
latencyString,
|
||||
stats.decodeMetrics.min, stats.decodeMetrics.max, stats.decodeMetrics.avg];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -56,6 +56,7 @@
|
||||
UITapGestureRecognizer *_menuTapGestureRecognizer;
|
||||
UITapGestureRecognizer *_menuDoubleTapGestureRecognizer;
|
||||
UITapGestureRecognizer *_playPauseTapGestureRecognizer;
|
||||
uint16_t overlayLevel;
|
||||
UILabel *_stageLabel;
|
||||
UILabel *_tipLabel;
|
||||
UIActivityIndicatorView *_spinner;
|
||||
@@ -335,6 +336,7 @@
|
||||
if (reloadSettings) {
|
||||
_settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here.
|
||||
}
|
||||
overlayLevel = _settings.statsOverlayLevel.intValue;
|
||||
[self configOscLayoutTool];
|
||||
[self updateToolboxSpecialEntries];
|
||||
[self configSwipeGestures];
|
||||
@@ -775,7 +777,8 @@
|
||||
}
|
||||
else [self.view addSubview:_overlayView]; // don't know why but this is necessary for reactivating overlay.
|
||||
|
||||
NSString* overlayText = [self->_streamMan getStatsOverlayText];
|
||||
NSString* overlayText = [self->_streamMan getStatsOverlayText:overlayLevel];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self updateOverlayText:overlayText];
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user