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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 if (rtp_config.fec.red_payload_type != -1) { | 332 if (rtp_config.fec.red_payload_type != -1) { |
333 RTC_HISTOGRAMS_COUNTS_10000(kIndex, | 333 RTC_HISTOGRAMS_COUNTS_10000(kIndex, |
334 uma_prefix_ + "FecBitrateSentInKbps", | 334 uma_prefix_ + "FecBitrateSentInKbps", |
335 static_cast<int>(rtp_rtx.fec.TotalBytes() * | 335 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
336 8 / elapsed_sec / 1000)); | 336 8 / elapsed_sec / 1000)); |
337 } | 337 } |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
342 void SendStatisticsProxy::SetContentType( | 342 void SendStatisticsProxy::OnEncoderReconfigured( |
343 VideoEncoderConfig::ContentType content_type) { | 343 const VideoEncoderConfig& config, |
| 344 uint32_t preferred_bitrate_bps) { |
344 rtc::CritScope lock(&crit_); | 345 rtc::CritScope lock(&crit_); |
345 if (content_type_ != content_type) { | 346 stats_.preferred_media_bitrate_bps = preferred_bitrate_bps; |
| 347 |
| 348 if (content_type_ != config.content_type) { |
346 uma_container_->UpdateHistograms(rtp_config_, stats_); | 349 uma_container_->UpdateHistograms(rtp_config_, stats_); |
347 uma_container_.reset( | 350 uma_container_.reset(new UmaSamplesContainer( |
348 new UmaSamplesContainer(GetUmaPrefix(content_type), stats_, clock_)); | 351 GetUmaPrefix(config.content_type), stats_, clock_)); |
349 content_type_ = content_type; | 352 content_type_ = config.content_type; |
350 } | 353 } |
351 } | 354 } |
352 | 355 |
353 void SendStatisticsProxy::OnEncoderStatsUpdate(uint32_t framerate, | 356 void SendStatisticsProxy::OnEncoderStatsUpdate(uint32_t framerate, |
354 uint32_t bitrate) { | 357 uint32_t bitrate) { |
355 rtc::CritScope lock(&crit_); | 358 rtc::CritScope lock(&crit_); |
356 stats_.encode_frame_rate = framerate; | 359 stats_.encode_frame_rate = framerate; |
357 stats_.media_bitrate_bps = bitrate; | 360 stats_.media_bitrate_bps = bitrate; |
358 } | 361 } |
359 | 362 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 return Fraction(min_required_samples, 1000.0f); | 644 return Fraction(min_required_samples, 1000.0f); |
642 } | 645 } |
643 | 646 |
644 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 647 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
645 int min_required_samples, float multiplier) const { | 648 int min_required_samples, float multiplier) const { |
646 if (num_samples < min_required_samples || num_samples == 0) | 649 if (num_samples < min_required_samples || num_samples == 0) |
647 return -1; | 650 return -1; |
648 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 651 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
649 } | 652 } |
650 } // namespace webrtc | 653 } // namespace webrtc |
OLD | NEW |