Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 RTC_HISTOGRAM_COUNTS_100000( | 52 RTC_HISTOGRAM_COUNTS_100000( |
| 53 "WebRTC.Video.RenderSqrtPixelsPerSecond", | 53 "WebRTC.Video.RenderSqrtPixelsPerSecond", |
| 54 round(render_pixel_tracker_.ComputeTotalRate())); | 54 round(render_pixel_tracker_.ComputeTotalRate())); |
| 55 } | 55 } |
| 56 int width = render_width_counter_.Avg(kMinRequiredSamples); | 56 int width = render_width_counter_.Avg(kMinRequiredSamples); |
| 57 int height = render_height_counter_.Avg(kMinRequiredSamples); | 57 int height = render_height_counter_.Avg(kMinRequiredSamples); |
| 58 if (width != -1) { | 58 if (width != -1) { |
| 59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); | 59 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedWidthInPixels", width); |
| 60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); | 60 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.ReceivedHeightInPixels", height); |
| 61 } | 61 } |
| 62 int sync_offset_ms = render_sync_offset_counter_.Avg(kMinRequiredSamples); | |
| 63 if (sync_offset_ms != -1) | |
| 64 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs", sync_offset_ms); | |
| 65 | |
| 62 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); | 66 int qp = qp_counters_.vp8.Avg(kMinRequiredSamples); |
| 63 if (qp != -1) | 67 if (qp != -1) |
| 64 RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); | 68 RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", qp); |
| 65 | 69 |
| 66 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and | 70 // TODO(asapersson): DecoderTiming() is call periodically (each 1000ms) and |
| 67 // not per frame. Change decode time to include every frame. | 71 // not per frame. Change decode time to include every frame. |
| 68 const int kMinRequiredDecodeSamples = 5; | 72 const int kMinRequiredDecodeSamples = 5; |
| 69 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); | 73 int decode_ms = decode_time_counter_.Avg(kMinRequiredDecodeSamples); |
| 70 if (decode_ms != -1) | 74 if (decode_ms != -1) |
| 71 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); | 75 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", decode_ms); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 } | 217 } |
| 214 | 218 |
| 215 void ReceiveStatisticsProxy::OnDecodedFrame() { | 219 void ReceiveStatisticsProxy::OnDecodedFrame() { |
| 216 uint64_t now = clock_->TimeInMilliseconds(); | 220 uint64_t now = clock_->TimeInMilliseconds(); |
| 217 | 221 |
| 218 rtc::CritScope lock(&crit_); | 222 rtc::CritScope lock(&crit_); |
| 219 decode_fps_estimator_.Update(1, now); | 223 decode_fps_estimator_.Update(1, now); |
| 220 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); | 224 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); |
| 221 } | 225 } |
| 222 | 226 |
| 223 void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) { | 227 void ReceiveStatisticsProxy::OnRenderedFrame(int width, |
| 228 int height, | |
| 229 int64_t stream_sync_offset_ms) { | |
| 224 RTC_DCHECK_GT(width, 0); | 230 RTC_DCHECK_GT(width, 0); |
| 225 RTC_DCHECK_GT(height, 0); | 231 RTC_DCHECK_GT(height, 0); |
| 226 uint64_t now = clock_->TimeInMilliseconds(); | 232 uint64_t now = clock_->TimeInMilliseconds(); |
| 227 | 233 |
| 228 rtc::CritScope lock(&crit_); | 234 rtc::CritScope lock(&crit_); |
| 229 renders_fps_estimator_.Update(1, now); | 235 renders_fps_estimator_.Update(1, now); |
| 230 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); | 236 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); |
| 231 render_width_counter_.Add(width); | 237 render_width_counter_.Add(width); |
| 232 render_height_counter_.Add(height); | 238 render_height_counter_.Add(height); |
| 233 render_fps_tracker_.AddSamples(1); | 239 render_fps_tracker_.AddSamples(1); |
| 234 render_pixel_tracker_.AddSamples(sqrt(width * height)); | 240 render_pixel_tracker_.AddSamples(sqrt(width * height)); |
| 241 | |
| 242 if (stream_sync_offset_ms != -1) | |
| 243 render_sync_offset_counter_.Add(stream_sync_offset_ms); | |
|
pbos-webrtc
2016/03/04 14:34:27
Should we expose this in getStats as well?
åsapersson
2016/03/09 15:44:35
Done.
| |
| 235 } | 244 } |
| 236 | 245 |
| 237 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, | 246 void ReceiveStatisticsProxy::OnReceiveRatesUpdated(uint32_t bitRate, |
| 238 uint32_t frameRate) { | 247 uint32_t frameRate) { |
| 239 } | 248 } |
| 240 | 249 |
| 241 void ReceiveStatisticsProxy::OnFrameCountsUpdated( | 250 void ReceiveStatisticsProxy::OnFrameCountsUpdated( |
| 242 const FrameCounts& frame_counts) { | 251 const FrameCounts& frame_counts) { |
| 243 rtc::CritScope lock(&crit_); | 252 rtc::CritScope lock(&crit_); |
| 244 stats_.frame_counts = frame_counts; | 253 stats_.frame_counts = frame_counts; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 265 ++num_samples; | 274 ++num_samples; |
| 266 } | 275 } |
| 267 | 276 |
| 268 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 277 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 269 if (num_samples < min_required_samples || num_samples == 0) | 278 if (num_samples < min_required_samples || num_samples == 0) |
| 270 return -1; | 279 return -1; |
| 271 return sum / num_samples; | 280 return sum / num_samples; |
| 272 } | 281 } |
| 273 | 282 |
| 274 } // namespace webrtc | 283 } // namespace webrtc |
| OLD | NEW |