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/send_statistics_proxy.h" | 11 #include "webrtc/video/send_statistics_proxy.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <map> | 14 #include <map> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 | 17 |
18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
19 #include "webrtc/system_wrappers/interface/logging.h" | 19 #include "webrtc/system_wrappers/interface/logging.h" |
20 #include "webrtc/system_wrappers/interface/metrics.h" | 20 #include "webrtc/system_wrappers/interface/metrics.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | 23 |
24 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; | 24 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
25 const size_t SendStatisticsProxy::kFrameRateTrackerInterval = 15u; | |
noahric
2015/08/07 23:56:38
I think you'll want this to be configurable, since
tpsiaki
2015/08/11 18:33:27
I switched this to be based on the kStatsTimeoutMs
| |
25 | 26 |
26 SendStatisticsProxy::SendStatisticsProxy(Clock* clock, | 27 SendStatisticsProxy::SendStatisticsProxy(Clock* clock, |
27 const VideoSendStream::Config& config) | 28 const VideoSendStream::Config& config) |
28 : clock_(clock), | 29 : clock_(clock), |
29 config_(config), | 30 config_(config), |
31 input_frame_rate_tracker_(kFrameRateTrackerInterval), | |
32 input_frame_rate_tracker_total_(kFrameRateTrackerInterval), | |
33 sent_frame_rate_tracker_total_(kFrameRateTrackerInterval), | |
30 last_sent_frame_timestamp_(0), | 34 last_sent_frame_timestamp_(0), |
31 max_sent_width_per_timestamp_(0), | 35 max_sent_width_per_timestamp_(0), |
32 max_sent_height_per_timestamp_(0) { | 36 max_sent_height_per_timestamp_(0) { |
33 } | 37 } |
34 | 38 |
35 SendStatisticsProxy::~SendStatisticsProxy() { | 39 SendStatisticsProxy::~SendStatisticsProxy() { |
36 UpdateHistograms(); | 40 UpdateHistograms(); |
37 } | 41 } |
38 | 42 |
39 void SendStatisticsProxy::UpdateHistograms() { | 43 void SendStatisticsProxy::UpdateHistograms() { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 ++num_samples; | 272 ++num_samples; |
269 } | 273 } |
270 | 274 |
271 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 275 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
272 if (num_samples < min_required_samples || num_samples == 0) | 276 if (num_samples < min_required_samples || num_samples == 0) |
273 return -1; | 277 return -1; |
274 return sum / num_samples; | 278 return sum / num_samples; |
275 } | 279 } |
276 | 280 |
277 } // namespace webrtc | 281 } // namespace webrtc |
OLD | NEW |