Add QP stats to the statsview in AppRTCMobile for ios.
The following QP stats are added: *avgQP for the current polling interval as a fraction of the current delta sum over the current delta of encoded frames *total QPSum *total number of encoded frames BUG=NONE Review-Url: https://codereview.webrtc.org/2578123002 Cr-Commit-Position: refs/heads/master@{#15669}
This commit is contained in:
parent
c3e1cabc69
commit
b6c456b772
@ -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;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user