| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 VideoEncoderConfig::ContentType content_type) { | 335 VideoEncoderConfig::ContentType content_type) { |
| 336 rtc::CritScope lock(&crit_); | 336 rtc::CritScope lock(&crit_); |
| 337 if (content_type_ != content_type) { | 337 if (content_type_ != content_type) { |
| 338 uma_container_->UpdateHistograms(config_, stats_); | 338 uma_container_->UpdateHistograms(config_, stats_); |
| 339 uma_container_.reset( | 339 uma_container_.reset( |
| 340 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); | 340 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); |
| 341 content_type_ = content_type; | 341 content_type_ = content_type; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 void SendStatisticsProxy::OnEncoderImplementationName( | 345 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, |
| 346 const char* implementation_name) { | 346 uint32_t bitrate, |
| 347 rtc::CritScope lock(&crit_); | 347 std::string&& encoder_name) { |
| 348 stats_.encoder_implementation_name = implementation_name; | |
| 349 } | |
| 350 | |
| 351 void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) { | |
| 352 rtc::CritScope lock(&crit_); | 348 rtc::CritScope lock(&crit_); |
| 353 stats_.encode_frame_rate = framerate; | 349 stats_.encode_frame_rate = framerate; |
| 354 stats_.media_bitrate_bps = bitrate; | 350 stats_.media_bitrate_bps = bitrate; |
| 351 stats_.encoder_implementation_name = encoder_name; |
| 355 } | 352 } |
| 356 | 353 |
| 357 void SendStatisticsProxy::OnEncodedFrameTimeMeasured( | 354 void SendStatisticsProxy::OnEncodedFrameTimeMeasured( |
| 358 int encode_time_ms, | 355 int encode_time_ms, |
| 359 const CpuOveruseMetrics& metrics) { | 356 const CpuOveruseMetrics& metrics) { |
| 360 rtc::CritScope lock(&crit_); | 357 rtc::CritScope lock(&crit_); |
| 361 uma_container_->encode_time_counter_.Add(encode_time_ms); | 358 uma_container_->encode_time_counter_.Add(encode_time_ms); |
| 362 encode_time_.Apply(1.0f, encode_time_ms); | 359 encode_time_.Apply(1.0f, encode_time_ms); |
| 363 stats_.avg_encode_time_ms = round(encode_time_.filtered()); | 360 stats_.avg_encode_time_ms = round(encode_time_.filtered()); |
| 364 stats_.encode_usage_percent = metrics.encode_usage_percent; | 361 stats_.encode_usage_percent = metrics.encode_usage_percent; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 return Fraction(min_required_samples, 1000.0f); | 621 return Fraction(min_required_samples, 1000.0f); |
| 625 } | 622 } |
| 626 | 623 |
| 627 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 624 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 628 int min_required_samples, float multiplier) const { | 625 int min_required_samples, float multiplier) const { |
| 629 if (num_samples < min_required_samples || num_samples == 0) | 626 if (num_samples < min_required_samples || num_samples == 0) |
| 630 return -1; | 627 return -1; |
| 631 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 628 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 632 } | 629 } |
| 633 } // namespace webrtc | 630 } // namespace webrtc |
| OLD | NEW |