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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); | 59 int sent_height = sent_height_counter_.Avg(kMinRequiredSamples); |
60 if (sent_width != -1) { | 60 if (sent_width != -1) { |
61 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); | 61 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentWidthInPixels", sent_width); |
62 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); | 62 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.SentHeightInPixels", sent_height); |
63 } | 63 } |
64 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); | 64 int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples); |
65 if (encode_ms != -1) | 65 if (encode_ms != -1) |
66 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); | 66 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms); |
67 } | 67 } |
68 | 68 |
69 void SendStatisticsProxy::OutgoingRate(const int video_channel, | 69 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { |
70 const unsigned int framerate, | |
71 const unsigned int bitrate) { | |
72 rtc::CritScope lock(&crit_); | 70 rtc::CritScope lock(&crit_); |
73 stats_.encode_frame_rate = framerate; | 71 stats_.encode_frame_rate = framerate; |
74 stats_.media_bitrate_bps = bitrate; | 72 stats_.media_bitrate_bps = bitrate; |
75 } | 73 } |
76 | 74 |
77 void SendStatisticsProxy::CpuOveruseMetricsUpdated( | 75 void SendStatisticsProxy::CpuOveruseMetricsUpdated( |
78 const CpuOveruseMetrics& metrics) { | 76 const CpuOveruseMetrics& metrics) { |
79 rtc::CritScope lock(&crit_); | 77 rtc::CritScope lock(&crit_); |
80 // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms. | 78 // TODO(asapersson): Change to use OnEncodedFrame() for avg_encode_time_ms. |
81 stats_.avg_encode_time_ms = metrics.avg_encode_time_ms; | 79 stats_.avg_encode_time_ms = metrics.avg_encode_time_ms; |
82 stats_.encode_usage_percent = metrics.encode_usage_percent; | 80 stats_.encode_usage_percent = metrics.encode_usage_percent; |
83 } | 81 } |
84 | 82 |
85 void SendStatisticsProxy::SuspendChange(int video_channel, bool is_suspended) { | 83 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { |
86 rtc::CritScope lock(&crit_); | 84 rtc::CritScope lock(&crit_); |
87 stats_.suspended = is_suspended; | 85 stats_.suspended = is_suspended; |
88 } | 86 } |
89 | 87 |
90 VideoSendStream::Stats SendStatisticsProxy::GetStats() { | 88 VideoSendStream::Stats SendStatisticsProxy::GetStats() { |
91 rtc::CritScope lock(&crit_); | 89 rtc::CritScope lock(&crit_); |
92 PurgeOldStats(); | 90 PurgeOldStats(); |
93 stats_.input_frame_rate = | 91 stats_.input_frame_rate = |
94 static_cast<int>(input_frame_rate_tracker_.ComputeRate()); | 92 static_cast<int>(input_frame_rate_tracker_.ComputeRate()); |
95 return stats_; | 93 return stats_; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 ++num_samples; | 267 ++num_samples; |
270 } | 268 } |
271 | 269 |
272 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { | 270 int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const { |
273 if (num_samples < min_required_samples || num_samples == 0) | 271 if (num_samples < min_required_samples || num_samples == 0) |
274 return -1; | 272 return -1; |
275 return sum / num_samples; | 273 return sum / num_samples; |
276 } | 274 } |
277 | 275 |
278 } // namespace webrtc | 276 } // namespace webrtc |
OLD | NEW |