Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m

Issue 2578123002: Add QP stats to the statsview in AppRTCMobile for ios. (Closed)
Patch Set: Add explicit comparison and set AvgQP to 0 when encoded frames is 0. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m b/webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m
index 0643b428273cc89c3d661d11423577fac07105a5..370b72e8677e4a3b4aecb58d62a9886ba925750b 100644
--- a/webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m
+++ b/webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m
@@ -41,6 +41,12 @@
NSString *_videoSendHeight;
NSString *_videoSendWidth;
+ // QP stats.
+ int _videoQPSum;
+ int _framesEncoded;
+ int _oldVideoQPSum;
+ int _oldFramesEncoded;
+
// Video receive stats.
NSString *_videoDecodeMs;
NSString *_videoDecodedFps;
@@ -77,6 +83,8 @@
_connRecvBitrateTracker = [[ARDBitrateTracker alloc] init];
_videoSendBitrateTracker = [[ARDBitrateTracker alloc] init];
_videoRecvBitrateTracker = [[ARDBitrateTracker alloc] init];
+ _videoQPSum = 0;
+ _framesEncoded = 0;
}
return self;
}
@@ -96,14 +104,18 @@
// Video send stats.
NSString *videoSendFormat = @"VS (input) %@x%@@%@fps | (sent) %@x%@@%@fps\n"
- "VS (enc) %@/%@ | (sent) %@/%@ | %@ms | %@\n";
+ "VS (enc) %@/%@ | (sent) %@/%@ | %@ms | %@\n"
+ "AvgQP (past %d encoded frames) = %d\n ";
+ int avgqp = [self calculateAvgQP];
+
[result appendString:[NSString stringWithFormat:videoSendFormat,
_videoInputWidth, _videoInputHeight, _videoInputFps,
_videoSendWidth, _videoSendHeight, _videoSendFps,
_actualEncBitrate, _targetEncBitrate,
_videoSendBitrate, _availableSendBw,
_videoEncodeMs,
- _videoSendCodec]];
+ _videoSendCodec,
+ _framesEncoded - _oldFramesEncoded, avgqp]];
// Video receive stats.
NSString *videoReceiveFormat =
@@ -148,6 +160,13 @@
#pragma mark - Private
+- (int)calculateAvgQP {
+ int deltaFramesEncoded = _framesEncoded - _oldFramesEncoded;
+ int deltaQPSum = _videoQPSum - _oldVideoQPSum;
+
+ return deltaFramesEncoded != 0 ? deltaQPSum / deltaFramesEncoded : 0;
+}
+
- (void)parseBweStatsReport:(RTCLegacyStatsReport *)statsReport {
[statsReport.values enumerateKeysAndObjectsUsingBlock:^(
NSString *key, NSString *value, BOOL *stop) {
@@ -241,6 +260,12 @@
NSInteger byteCount = value.integerValue;
[_videoSendBitrateTracker updateBitrateWithCurrentByteCount:byteCount];
_videoSendBitrate = _videoSendBitrateTracker.bitrateString;
+ } else if ([key isEqualToString:@"qpSum"]) {
+ _oldVideoQPSum = _videoQPSum;
+ _videoQPSum = value.integerValue;
+ } else if ([key isEqualToString:@"framesEncoded"]) {
+ _oldFramesEncoded = _framesEncoded;
+ _framesEncoded = value.integerValue;
}
}];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698