| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 uma_container_->input_fps_counter_.Add(1); | 710 uma_container_->input_fps_counter_.Add(1); |
| 711 uma_container_->input_width_counter_.Add(width); | 711 uma_container_->input_width_counter_.Add(width); |
| 712 uma_container_->input_height_counter_.Add(height); | 712 uma_container_->input_height_counter_.Add(height); |
| 713 if (cpu_downscales_ >= 0) { | 713 if (cpu_downscales_ >= 0) { |
| 714 uma_container_->cpu_limited_frame_counter_.Add( | 714 uma_container_->cpu_limited_frame_counter_.Add( |
| 715 stats_.cpu_limited_resolution); | 715 stats_.cpu_limited_resolution); |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 | 718 |
| 719 void SendStatisticsProxy::SetAdaptationStats( | 719 void SendStatisticsProxy::SetAdaptationStats( |
| 720 const ViEEncoder::AdaptCounts& cpu_counts, | 720 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 721 const ViEEncoder::AdaptCounts& quality_counts) { | 721 const VideoStreamEncoder::AdaptCounts& quality_counts) { |
| 722 rtc::CritScope lock(&crit_); | 722 rtc::CritScope lock(&crit_); |
| 723 SetAdaptTimer(cpu_counts, &uma_container_->cpu_adapt_timer_); | 723 SetAdaptTimer(cpu_counts, &uma_container_->cpu_adapt_timer_); |
| 724 SetAdaptTimer(quality_counts, &uma_container_->quality_adapt_timer_); | 724 SetAdaptTimer(quality_counts, &uma_container_->quality_adapt_timer_); |
| 725 UpdateAdaptationStats(cpu_counts, quality_counts); | 725 UpdateAdaptationStats(cpu_counts, quality_counts); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void SendStatisticsProxy::OnCpuAdaptationChanged( | 728 void SendStatisticsProxy::OnCpuAdaptationChanged( |
| 729 const ViEEncoder::AdaptCounts& cpu_counts, | 729 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 730 const ViEEncoder::AdaptCounts& quality_counts) { | 730 const VideoStreamEncoder::AdaptCounts& quality_counts) { |
| 731 rtc::CritScope lock(&crit_); | 731 rtc::CritScope lock(&crit_); |
| 732 ++stats_.number_of_cpu_adapt_changes; | 732 ++stats_.number_of_cpu_adapt_changes; |
| 733 UpdateAdaptationStats(cpu_counts, quality_counts); | 733 UpdateAdaptationStats(cpu_counts, quality_counts); |
| 734 } | 734 } |
| 735 | 735 |
| 736 void SendStatisticsProxy::OnQualityAdaptationChanged( | 736 void SendStatisticsProxy::OnQualityAdaptationChanged( |
| 737 const ViEEncoder::AdaptCounts& cpu_counts, | 737 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 738 const ViEEncoder::AdaptCounts& quality_counts) { | 738 const VideoStreamEncoder::AdaptCounts& quality_counts) { |
| 739 rtc::CritScope lock(&crit_); | 739 rtc::CritScope lock(&crit_); |
| 740 ++stats_.number_of_quality_adapt_changes; | 740 ++stats_.number_of_quality_adapt_changes; |
| 741 UpdateAdaptationStats(cpu_counts, quality_counts); | 741 UpdateAdaptationStats(cpu_counts, quality_counts); |
| 742 } | 742 } |
| 743 | 743 |
| 744 void SendStatisticsProxy::UpdateAdaptationStats( | 744 void SendStatisticsProxy::UpdateAdaptationStats( |
| 745 const ViEEncoder::AdaptCounts& cpu_counts, | 745 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 746 const ViEEncoder::AdaptCounts& quality_counts) { | 746 const VideoStreamEncoder::AdaptCounts& quality_counts) { |
| 747 cpu_downscales_ = cpu_counts.resolution; | 747 cpu_downscales_ = cpu_counts.resolution; |
| 748 quality_downscales_ = quality_counts.resolution; | 748 quality_downscales_ = quality_counts.resolution; |
| 749 | 749 |
| 750 stats_.cpu_limited_resolution = cpu_counts.resolution > 0; | 750 stats_.cpu_limited_resolution = cpu_counts.resolution > 0; |
| 751 stats_.cpu_limited_framerate = cpu_counts.fps > 0; | 751 stats_.cpu_limited_framerate = cpu_counts.fps > 0; |
| 752 stats_.bw_limited_resolution = quality_counts.resolution > 0; | 752 stats_.bw_limited_resolution = quality_counts.resolution > 0; |
| 753 stats_.bw_limited_framerate = quality_counts.fps > 0; | 753 stats_.bw_limited_framerate = quality_counts.fps > 0; |
| 754 } | 754 } |
| 755 | 755 |
| 756 void SendStatisticsProxy::SetAdaptTimer(const ViEEncoder::AdaptCounts& counts, | 756 void SendStatisticsProxy::SetAdaptTimer( |
| 757 StatsTimer* timer) { | 757 const VideoStreamEncoder::AdaptCounts& counts, |
| 758 StatsTimer* timer) { |
| 758 if (counts.resolution >= 0 || counts.fps >= 0) { | 759 if (counts.resolution >= 0 || counts.fps >= 0) { |
| 759 // Adaptation enabled. | 760 // Adaptation enabled. |
| 760 if (!stats_.suspended) | 761 if (!stats_.suspended) |
| 761 timer->Start(clock_->TimeInMilliseconds()); | 762 timer->Start(clock_->TimeInMilliseconds()); |
| 762 return; | 763 return; |
| 763 } | 764 } |
| 764 timer->Stop(clock_->TimeInMilliseconds()); | 765 timer->Stop(clock_->TimeInMilliseconds()); |
| 765 } | 766 } |
| 766 | 767 |
| 767 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( | 768 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 } | 915 } |
| 915 | 916 |
| 916 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 917 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
| 917 int64_t min_required_samples, | 918 int64_t min_required_samples, |
| 918 float multiplier) const { | 919 float multiplier) const { |
| 919 if (num_samples < min_required_samples || num_samples == 0) | 920 if (num_samples < min_required_samples || num_samples == 0) |
| 920 return -1; | 921 return -1; |
| 921 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 922 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
| 922 } | 923 } |
| 923 } // namespace webrtc | 924 } // namespace webrtc |
| OLD | NEW |