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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc; | 240 RTC_NOTREACHED() << "Unexpected stream ssrc: " << ssrc; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void ReceiveStatisticsProxy::OnDecodedFrame() { | 245 void ReceiveStatisticsProxy::OnDecodedFrame() { |
| 246 uint64_t now = clock_->TimeInMilliseconds(); | 246 uint64_t now = clock_->TimeInMilliseconds(); |
| 247 | 247 |
| 248 rtc::CritScope lock(&crit_); | 248 rtc::CritScope lock(&crit_); |
| 249 decode_fps_estimator_.Update(1, now); | 249 decode_fps_estimator_.Update(1, now); |
| 250 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now); | 250 stats_.decode_frame_rate = decode_fps_estimator_.Rate(now).value_or(1); |
|
stefan-webrtc
2016/06/02 07:16:42
I'm not convinced this is correct. What if there a
sprang_webrtc
2016/06/02 08:09:32
Yeah, you're right. I'll change it to default zero
stefan-webrtc
2016/06/02 08:14:39
So, will we now ever be able to measure 1 fps? :)
sprang
2016/06/02 09:00:51
Not if the actual rate is <= 1 fps. But slightly m
stefan-webrtc
2016/06/02 09:05:51
Not sure. I'm mostly thinking whether it would mak
sprang_webrtc
2016/06/02 12:23:50
Done. PTAL
| |
| 251 } | 251 } |
| 252 | 252 |
| 253 void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) { | 253 void ReceiveStatisticsProxy::OnRenderedFrame(int width, int height) { |
| 254 RTC_DCHECK_GT(width, 0); | 254 RTC_DCHECK_GT(width, 0); |
| 255 RTC_DCHECK_GT(height, 0); | 255 RTC_DCHECK_GT(height, 0); |
| 256 uint64_t now = clock_->TimeInMilliseconds(); | 256 uint64_t now = clock_->TimeInMilliseconds(); |
| 257 | 257 |
| 258 rtc::CritScope lock(&crit_); | 258 rtc::CritScope lock(&crit_); |
| 259 renders_fps_estimator_.Update(1, now); | 259 renders_fps_estimator_.Update(1, now); |
| 260 stats_.render_frame_rate = renders_fps_estimator_.Rate(now); | 260 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(1); |
| 261 render_width_counter_.Add(width); | 261 render_width_counter_.Add(width); |
| 262 render_height_counter_.Add(height); | 262 render_height_counter_.Add(height); |
| 263 render_fps_tracker_.AddSamples(1); | 263 render_fps_tracker_.AddSamples(1); |
| 264 render_pixel_tracker_.AddSamples(sqrt(width * height)); | 264 render_pixel_tracker_.AddSamples(sqrt(width * height)); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) { | 267 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) { |
| 268 rtc::CritScope lock(&crit_); | 268 rtc::CritScope lock(&crit_); |
| 269 sync_offset_counter_.Add(std::abs(sync_offset_ms)); | 269 sync_offset_counter_.Add(std::abs(sync_offset_ms)); |
| 270 stats_.sync_offset_ms = sync_offset_ms; | 270 stats_.sync_offset_ms = sync_offset_ms; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 301 ++num_samples; | 301 ++num_samples; |
| 302 } | 302 } |
| 303 | 303 |
| 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 305 if (num_samples < min_required_samples || num_samples == 0) | 305 if (num_samples < min_required_samples || num_samples == 0) |
| 306 return -1; | 306 return -1; |
| 307 return sum / num_samples; | 307 return sum / num_samples; |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace webrtc | 310 } // namespace webrtc |
| OLD | NEW |