OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... | |
34 NSString *_videoEncodeMs; | 34 NSString *_videoEncodeMs; |
35 NSString *_videoInputFps; | 35 NSString *_videoInputFps; |
36 NSString *_videoInputHeight; | 36 NSString *_videoInputHeight; |
37 NSString *_videoInputWidth; | 37 NSString *_videoInputWidth; |
38 NSString *_videoSendCodec; | 38 NSString *_videoSendCodec; |
39 NSString *_videoSendBitrate; | 39 NSString *_videoSendBitrate; |
40 NSString *_videoSendFps; | 40 NSString *_videoSendFps; |
41 NSString *_videoSendHeight; | 41 NSString *_videoSendHeight; |
42 NSString *_videoSendWidth; | 42 NSString *_videoSendWidth; |
43 | 43 |
44 // QP stats. | |
45 int _videoQPSum; | |
46 int _framesEncoded; | |
47 int _oldVideoQPSum; | |
48 int _oldFramesEncoded; | |
49 int _deltaQPSum; | |
50 int _deltaFramesEncoded; | |
kthelgason
2016/12/16 09:41:37
I don't think the _delta* variables need to be sto
daniela-webrtc
2016/12/16 11:39:32
Done.
| |
51 | |
44 // Video receive stats. | 52 // Video receive stats. |
45 NSString *_videoDecodeMs; | 53 NSString *_videoDecodeMs; |
46 NSString *_videoDecodedFps; | 54 NSString *_videoDecodedFps; |
47 NSString *_videoOutputFps; | 55 NSString *_videoOutputFps; |
48 NSString *_videoRecvBitrate; | 56 NSString *_videoRecvBitrate; |
49 NSString *_videoRecvFps; | 57 NSString *_videoRecvFps; |
50 NSString *_videoRecvHeight; | 58 NSString *_videoRecvHeight; |
51 NSString *_videoRecvWidth; | 59 NSString *_videoRecvWidth; |
52 | 60 |
53 // Audio send stats. | 61 // Audio send stats. |
(...skipping 16 matching lines...) Expand all Loading... | |
70 } | 78 } |
71 | 79 |
72 - (instancetype)init { | 80 - (instancetype)init { |
73 if (self = [super init]) { | 81 if (self = [super init]) { |
74 _audioSendBitrateTracker = [[ARDBitrateTracker alloc] init]; | 82 _audioSendBitrateTracker = [[ARDBitrateTracker alloc] init]; |
75 _audioRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; | 83 _audioRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; |
76 _connSendBitrateTracker = [[ARDBitrateTracker alloc] init]; | 84 _connSendBitrateTracker = [[ARDBitrateTracker alloc] init]; |
77 _connRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; | 85 _connRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; |
78 _videoSendBitrateTracker = [[ARDBitrateTracker alloc] init]; | 86 _videoSendBitrateTracker = [[ARDBitrateTracker alloc] init]; |
79 _videoRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; | 87 _videoRecvBitrateTracker = [[ARDBitrateTracker alloc] init]; |
88 _oldVideoQPSum = 0; | |
89 _oldFramesEncoded = 0; | |
80 } | 90 } |
81 return self; | 91 return self; |
82 } | 92 } |
83 | 93 |
84 - (NSString *)statsString { | 94 - (NSString *)statsString { |
85 NSMutableString *result = [NSMutableString string]; | 95 NSMutableString *result = [NSMutableString string]; |
86 NSString *systemStatsFormat = @"(cpu)%ld%%\n"; | 96 NSString *systemStatsFormat = @"(cpu)%ld%%\n"; |
87 [result appendString:[NSString stringWithFormat:systemStatsFormat, | 97 [result appendString:[NSString stringWithFormat:systemStatsFormat, |
88 (long)ARDGetCpuUsagePercentage()]]; | 98 (long)ARDGetCpuUsagePercentage()]]; |
89 | 99 |
90 // Connection stats. | 100 // Connection stats. |
91 NSString *connStatsFormat = @"CN %@ms | %@->%@/%@ | (s)%@ | (r)%@\n"; | 101 NSString *connStatsFormat = @"CN %@ms | %@->%@/%@ | (s)%@ | (r)%@\n"; |
92 [result appendString:[NSString stringWithFormat:connStatsFormat, | 102 [result appendString:[NSString stringWithFormat:connStatsFormat, |
93 _connRtt, | 103 _connRtt, |
94 _localCandType, _remoteCandType, _transportType, | 104 _localCandType, _remoteCandType, _transportType, |
95 _connSendBitrate, _connRecvBitrate]]; | 105 _connSendBitrate, _connRecvBitrate]]; |
96 | 106 |
97 // Video send stats. | 107 // Video send stats. |
98 NSString *videoSendFormat = @"VS (input) %@x%@@%@fps | (sent) %@x%@@%@fps\n" | 108 NSString *videoSendFormat = @"VS (input) %@x%@@%@fps | (sent) %@x%@@%@fps\n" |
99 "VS (enc) %@/%@ | (sent) %@/%@ | %@ms | %@\n"; | 109 "VS (enc) %@/%@ | (sent) %@/%@ | %@ms | %@\n" |
110 "QP %d | (QPSum)%d| (Frames encoded)%d\n "; | |
kthelgason
2016/12/16 09:41:37
I'm not sure we ever care about the QPSum and fram
daniela-webrtc
2016/12/16 11:39:32
Done.
| |
111 int avgqp = _deltaFramesEncoded ? _deltaQPSum / _deltaFramesEncoded : 1; | |
100 [result appendString:[NSString stringWithFormat:videoSendFormat, | 112 [result appendString:[NSString stringWithFormat:videoSendFormat, |
101 _videoInputWidth, _videoInputHeight, _videoInputFps, | 113 _videoInputWidth, _videoInputHeight, _videoInputFps, |
102 _videoSendWidth, _videoSendHeight, _videoSendFps, | 114 _videoSendWidth, _videoSendHeight, _videoSendFps, |
103 _actualEncBitrate, _targetEncBitrate, | 115 _actualEncBitrate, _targetEncBitrate, |
104 _videoSendBitrate, _availableSendBw, | 116 _videoSendBitrate, _availableSendBw, |
105 _videoEncodeMs, | 117 _videoEncodeMs, |
106 _videoSendCodec]]; | 118 _videoSendCodec, |
119 avgqp, _videoQPSum, _framesEncoded]]; | |
107 | 120 |
108 // Video receive stats. | 121 // Video receive stats. |
109 NSString *videoReceiveFormat = | 122 NSString *videoReceiveFormat = |
110 @"VR (recv) %@x%@@%@fps | (decoded)%@ | (output)%@fps | %@/%@ | %@ms\n"; | 123 @"VR (recv) %@x%@@%@fps | (decoded)%@ | (output)%@fps | %@/%@ | %@ms\n"; |
111 [result appendString:[NSString stringWithFormat:videoReceiveFormat, | 124 [result appendString:[NSString stringWithFormat:videoReceiveFormat, |
112 _videoRecvWidth, _videoRecvHeight, _videoRecvFps, | 125 _videoRecvWidth, _videoRecvHeight, _videoRecvFps, |
113 _videoDecodedFps, | 126 _videoDecodedFps, |
114 _videoOutputFps, | 127 _videoOutputFps, |
115 _videoRecvBitrate, _availableRecvBw, | 128 _videoRecvBitrate, _availableRecvBw, |
116 _videoDecodeMs]]; | 129 _videoDecodeMs]]; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 } else if ([key isEqualToString:@"googFrameWidthSent"]) { | 247 } else if ([key isEqualToString:@"googFrameWidthSent"]) { |
235 _videoSendWidth = value; | 248 _videoSendWidth = value; |
236 } else if ([key isEqualToString:@"googFrameRateSent"]) { | 249 } else if ([key isEqualToString:@"googFrameRateSent"]) { |
237 _videoSendFps = value; | 250 _videoSendFps = value; |
238 } else if ([key isEqualToString:@"googAvgEncodeMs"]) { | 251 } else if ([key isEqualToString:@"googAvgEncodeMs"]) { |
239 _videoEncodeMs = value; | 252 _videoEncodeMs = value; |
240 } else if ([key isEqualToString:@"bytesSent"]) { | 253 } else if ([key isEqualToString:@"bytesSent"]) { |
241 NSInteger byteCount = value.integerValue; | 254 NSInteger byteCount = value.integerValue; |
242 [_videoSendBitrateTracker updateBitrateWithCurrentByteCount:byteCount]; | 255 [_videoSendBitrateTracker updateBitrateWithCurrentByteCount:byteCount]; |
243 _videoSendBitrate = _videoSendBitrateTracker.bitrateString; | 256 _videoSendBitrate = _videoSendBitrateTracker.bitrateString; |
257 } else if ([key isEqualToString:@"qpSum"]) { | |
258 _videoQPSum = value.integerValue; | |
259 _deltaQPSum = _videoQPSum - _oldVideoQPSum; | |
260 _oldVideoQPSum = _videoQPSum; | |
261 } else if ([key isEqualToString:@"framesEncoded"]) { | |
262 _framesEncoded = value.integerValue; | |
263 _deltaFramesEncoded = _framesEncoded - _oldFramesEncoded; | |
264 _oldFramesEncoded = _framesEncoded; | |
244 } | 265 } |
245 }]; | 266 }]; |
246 } | 267 } |
247 | 268 |
248 - (void)parseRecvSsrcStatsReport:(RTCLegacyStatsReport *)statsReport { | 269 - (void)parseRecvSsrcStatsReport:(RTCLegacyStatsReport *)statsReport { |
249 NSDictionary *values = statsReport.values; | 270 NSDictionary *values = statsReport.values; |
250 if ([values objectForKey:@"googFrameWidthReceived"]) { | 271 if ([values objectForKey:@"googFrameWidthReceived"]) { |
251 // Video track. | 272 // Video track. |
252 [self parseVideoRecvStatsReport:statsReport]; | 273 [self parseVideoRecvStatsReport:statsReport]; |
253 } else if ([values objectForKey:@"audioOutputLevel"]) { | 274 } else if ([values objectForKey:@"audioOutputLevel"]) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 } else if ([key isEqualToString:@"bytesReceived"]) { | 312 } else if ([key isEqualToString:@"bytesReceived"]) { |
292 NSInteger byteCount = value.integerValue; | 313 NSInteger byteCount = value.integerValue; |
293 [_videoRecvBitrateTracker updateBitrateWithCurrentByteCount:byteCount]; | 314 [_videoRecvBitrateTracker updateBitrateWithCurrentByteCount:byteCount]; |
294 _videoRecvBitrate = _videoRecvBitrateTracker.bitrateString; | 315 _videoRecvBitrate = _videoRecvBitrateTracker.bitrateString; |
295 } | 316 } |
296 }]; | 317 }]; |
297 } | 318 } |
298 | 319 |
299 @end | 320 @end |
300 | 321 |
OLD | NEW |