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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 rtc::CritScope lock(&crit_); | 172 rtc::CritScope lock(&crit_); |
173 stats_.encoder_implementation_name = implementation_name; | 173 stats_.encoder_implementation_name = implementation_name; |
174 } | 174 } |
175 | 175 |
176 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { | 176 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { |
177 rtc::CritScope lock(&crit_); | 177 rtc::CritScope lock(&crit_); |
178 stats_.encode_frame_rate = framerate; | 178 stats_.encode_frame_rate = framerate; |
179 stats_.media_bitrate_bps = bitrate; | 179 stats_.media_bitrate_bps = bitrate; |
180 } | 180 } |
181 | 181 |
182 void SendStatisticsProxy::CpuOveruseMetricsUpdated( | 182 void SendStatisticsProxy::OnEncodedFrameTimeMeasured( |
| 183 int encode_time_ms, |
183 const CpuOveruseMetrics& metrics) { | 184 const CpuOveruseMetrics& metrics) { |
184 rtc::CritScope lock(&crit_); | 185 rtc::CritScope lock(&crit_); |
| 186 uma_container_->encode_time_counter_.Add(encode_time_ms); |
| 187 encode_time_.Apply(1.0f, encode_time_ms); |
| 188 stats_.avg_encode_time_ms = round(encode_time_.filtered()); |
185 stats_.encode_usage_percent = metrics.encode_usage_percent; | 189 stats_.encode_usage_percent = metrics.encode_usage_percent; |
186 } | 190 } |
187 | 191 |
188 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { | 192 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { |
189 rtc::CritScope lock(&crit_); | 193 rtc::CritScope lock(&crit_); |
190 stats_.suspended = is_suspended; | 194 stats_.suspended = is_suspended; |
191 } | 195 } |
192 | 196 |
193 VideoSendStream::Stats SendStatisticsProxy::GetStats() { | 197 VideoSendStream::Stats SendStatisticsProxy::GetStats() { |
194 rtc::CritScope lock(&crit_); | 198 rtc::CritScope lock(&crit_); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 static_cast<int>(encoded_image._encodedHeight)); | 318 static_cast<int>(encoded_image._encodedHeight)); |
315 } | 319 } |
316 | 320 |
317 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { | 321 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
318 rtc::CritScope lock(&crit_); | 322 rtc::CritScope lock(&crit_); |
319 uma_container_->input_frame_rate_tracker_.AddSamples(1); | 323 uma_container_->input_frame_rate_tracker_.AddSamples(1); |
320 uma_container_->input_width_counter_.Add(width); | 324 uma_container_->input_width_counter_.Add(width); |
321 uma_container_->input_height_counter_.Add(height); | 325 uma_container_->input_height_counter_.Add(height); |
322 } | 326 } |
323 | 327 |
324 void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) { | |
325 rtc::CritScope lock(&crit_); | |
326 uma_container_->encode_time_counter_.Add(encode_time_ms); | |
327 encode_time_.Apply(1.0f, encode_time_ms); | |
328 stats_.avg_encode_time_ms = round(encode_time_.filtered()); | |
329 } | |
330 | |
331 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 328 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
332 uint32_t ssrc, | 329 uint32_t ssrc, |
333 const RtcpPacketTypeCounter& packet_counter) { | 330 const RtcpPacketTypeCounter& packet_counter) { |
334 rtc::CritScope lock(&crit_); | 331 rtc::CritScope lock(&crit_); |
335 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 332 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
336 if (stats == nullptr) | 333 if (stats == nullptr) |
337 return; | 334 return; |
338 | 335 |
339 stats->rtcp_packet_type_counts = packet_counter; | 336 stats->rtcp_packet_type_counts = packet_counter; |
340 } | 337 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 return Fraction(min_required_samples, 1000.0f); | 423 return Fraction(min_required_samples, 1000.0f); |
427 } | 424 } |
428 | 425 |
429 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 426 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
430 int min_required_samples, float multiplier) const { | 427 int min_required_samples, float multiplier) const { |
431 if (num_samples < min_required_samples || num_samples == 0) | 428 if (num_samples < min_required_samples || num_samples == 0) |
432 return -1; | 429 return -1; |
433 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 430 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
434 } | 431 } |
435 } // namespace webrtc | 432 } // namespace webrtc |
OLD | NEW |