| 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 |
| 11 #include "webrtc/video/receive_statistics_proxy.h" | 11 #include "webrtc/video/receive_statistics_proxy.h" |
| 12 | 12 |
| 13 #include <cmath> | 13 #include <cmath> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 16 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
| 17 #include "webrtc/system_wrappers/include/clock.h" | 17 #include "webrtc/system_wrappers/include/clock.h" |
| 18 #include "webrtc/system_wrappers/include/metrics.h" | 18 #include "webrtc/system_wrappers/include/metrics.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 ReceiveStatisticsProxy::ReceiveStatisticsProxy( | 22 ReceiveStatisticsProxy::ReceiveStatisticsProxy( |
| 23 const VideoReceiveStream::Config& config, | 23 const VideoReceiveStream::Config& config, |
| 24 Clock* clock) | 24 Clock* clock) |
| 25 : clock_(clock), | 25 : clock_(clock), |
| 26 config_(config), | 26 config_(config), |
| 27 // 1000ms window, scale 1000 for ms to s. | 27 // 1000ms window, scale 1000 for ms to s. |
| 28 decode_fps_estimator_(1000, 1000), | 28 decode_fps_estimator_(1000, 1000), |
| 29 renders_fps_estimator_(1000, 1000), | 29 renders_fps_estimator_(1000, 1000), |
| 30 render_fps_tracker_(100u, 10u), | 30 render_fps_tracker_(100, 10u), |
| 31 render_pixel_tracker_(100u, 10u) { | 31 render_pixel_tracker_(100, 10u) { |
| 32 stats_.ssrc = config.rtp.remote_ssrc; | 32 stats_.ssrc = config.rtp.remote_ssrc; |
| 33 for (auto it : config.rtp.rtx) | 33 for (auto it : config.rtp.rtx) |
| 34 rtx_stats_[it.second.ssrc] = StreamDataCounters(); | 34 rtx_stats_[it.second.ssrc] = StreamDataCounters(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { | 37 ReceiveStatisticsProxy::~ReceiveStatisticsProxy() { |
| 38 UpdateHistograms(); | 38 UpdateHistograms(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void ReceiveStatisticsProxy::UpdateHistograms() { | 41 void ReceiveStatisticsProxy::UpdateHistograms() { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ++num_samples; | 299 ++num_samples; |
| 300 } | 300 } |
| 301 | 301 |
| 302 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 302 int ReceiveStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
| 303 if (num_samples < min_required_samples || num_samples == 0) | 303 if (num_samples < min_required_samples || num_samples == 0) |
| 304 return -1; | 304 return -1; |
| 305 return sum / num_samples; | 305 return sum / num_samples; |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace webrtc | 308 } // namespace webrtc |
| OLD | NEW |