| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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).value_or(0); | 260 stats_.render_frame_rate = renders_fps_estimator_.Rate(now).value_or(0); |
| 261 stats_.width = width; |
| 262 stats_.height = height; |
| 261 render_width_counter_.Add(width); | 263 render_width_counter_.Add(width); |
| 262 render_height_counter_.Add(height); | 264 render_height_counter_.Add(height); |
| 263 render_fps_tracker_.AddSamples(1); | 265 render_fps_tracker_.AddSamples(1); |
| 264 render_pixel_tracker_.AddSamples(sqrt(width * height)); | 266 render_pixel_tracker_.AddSamples(sqrt(width * height)); |
| 265 } | 267 } |
| 266 | 268 |
| 267 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) { | 269 void ReceiveStatisticsProxy::OnSyncOffsetUpdated(int64_t sync_offset_ms) { |
| 268 rtc::CritScope lock(&crit_); | 270 rtc::CritScope lock(&crit_); |
| 269 sync_offset_counter_.Add(std::abs(sync_offset_ms)); | 271 sync_offset_counter_.Add(std::abs(sync_offset_ms)); |
| 270 stats_.sync_offset_ms = sync_offset_ms; | 272 stats_.sync_offset_ms = sync_offset_ms; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 301 ++num_samples; | 303 ++num_samples; |
| 302 } | 304 } |
| 303 | 305 |
| 304 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 306 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 305 if (num_samples < min_required_samples || num_samples == 0) | 307 if (num_samples < min_required_samples || num_samples == 0) |
| 306 return -1; | 308 return -1; |
| 307 return sum / num_samples; | 309 return sum / num_samples; |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace webrtc | 312 } // namespace webrtc |
| OLD | NEW |