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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 rtc::CritScope lock(&crit_); | 182 rtc::CritScope lock(&crit_); |
183 stats_.encoder_implementation_name = implementation_name; | 183 stats_.encoder_implementation_name = implementation_name; |
184 } | 184 } |
185 | 185 |
186 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { | 186 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { |
187 rtc::CritScope lock(&crit_); | 187 rtc::CritScope lock(&crit_); |
188 stats_.encode_frame_rate = framerate; | 188 stats_.encode_frame_rate = framerate; |
189 stats_.media_bitrate_bps = bitrate; | 189 stats_.media_bitrate_bps = bitrate; |
190 } | 190 } |
191 | 191 |
192 void SendStatisticsProxy::CpuOveruseMetricsUpdated( | 192 void SendStatisticsProxy::OnEncodedFrameTimeMeasured( |
| 193 int encode_time_ms, |
193 const CpuOveruseMetrics& metrics) { | 194 const CpuOveruseMetrics& metrics) { |
194 rtc::CritScope lock(&crit_); | 195 rtc::CritScope lock(&crit_); |
| 196 uma_container_->encode_time_counter_.Add(encode_time_ms); |
| 197 encode_time_.Apply(1.0f, encode_time_ms); |
| 198 stats_.avg_encode_time_ms = round(encode_time_.filtered()); |
195 stats_.encode_usage_percent = metrics.encode_usage_percent; | 199 stats_.encode_usage_percent = metrics.encode_usage_percent; |
196 } | 200 } |
197 | 201 |
198 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { | 202 void SendStatisticsProxy::OnSuspendChange(bool is_suspended) { |
199 rtc::CritScope lock(&crit_); | 203 rtc::CritScope lock(&crit_); |
200 stats_.suspended = is_suspended; | 204 stats_.suspended = is_suspended; |
201 } | 205 } |
202 | 206 |
203 VideoSendStream::Stats SendStatisticsProxy::GetStats() { | 207 VideoSendStream::Stats SendStatisticsProxy::GetStats() { |
204 rtc::CritScope lock(&crit_); | 208 rtc::CritScope lock(&crit_); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 static_cast<int>(encoded_image._encodedHeight)); | 328 static_cast<int>(encoded_image._encodedHeight)); |
325 } | 329 } |
326 | 330 |
327 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { | 331 void SendStatisticsProxy::OnIncomingFrame(int width, int height) { |
328 rtc::CritScope lock(&crit_); | 332 rtc::CritScope lock(&crit_); |
329 uma_container_->input_frame_rate_tracker_.AddSamples(1); | 333 uma_container_->input_frame_rate_tracker_.AddSamples(1); |
330 uma_container_->input_width_counter_.Add(width); | 334 uma_container_->input_width_counter_.Add(width); |
331 uma_container_->input_height_counter_.Add(height); | 335 uma_container_->input_height_counter_.Add(height); |
332 } | 336 } |
333 | 337 |
334 void SendStatisticsProxy::OnEncodedFrame(int encode_time_ms) { | |
335 rtc::CritScope lock(&crit_); | |
336 uma_container_->encode_time_counter_.Add(encode_time_ms); | |
337 encode_time_.Apply(1.0f, encode_time_ms); | |
338 stats_.avg_encode_time_ms = round(encode_time_.filtered()); | |
339 } | |
340 | |
341 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 338 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
342 uint32_t ssrc, | 339 uint32_t ssrc, |
343 const RtcpPacketTypeCounter& packet_counter) { | 340 const RtcpPacketTypeCounter& packet_counter) { |
344 rtc::CritScope lock(&crit_); | 341 rtc::CritScope lock(&crit_); |
345 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); | 342 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); |
346 if (stats == nullptr) | 343 if (stats == nullptr) |
347 return; | 344 return; |
348 | 345 |
349 stats->rtcp_packet_type_counts = packet_counter; | 346 stats->rtcp_packet_type_counts = packet_counter; |
350 } | 347 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 return Fraction(min_required_samples, 1000.0f); | 433 return Fraction(min_required_samples, 1000.0f); |
437 } | 434 } |
438 | 435 |
439 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 436 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
440 int min_required_samples, float multiplier) const { | 437 int min_required_samples, float multiplier) const { |
441 if (num_samples < min_required_samples || num_samples == 0) | 438 if (num_samples < min_required_samples || num_samples == 0) |
442 return -1; | 439 return -1; |
443 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 440 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
444 } | 441 } |
445 } // namespace webrtc | 442 } // namespace webrtc |
OLD | NEW |