| 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 fake_clock_.AdvanceTimeMilliseconds(1000 / kFps); | 834 fake_clock_.AdvanceTimeMilliseconds(1000 / kFps); |
| 835 encoded_image._timeStamp = i + 1; | 835 encoded_image._timeStamp = i + 1; |
| 836 statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); | 836 statistics_proxy_->OnSendEncodedImage(encoded_image, nullptr); |
| 837 } | 837 } |
| 838 // Suspended time interval should not affect the framerate. | 838 // Suspended time interval should not affect the framerate. |
| 839 statistics_proxy_.reset(); | 839 statistics_proxy_.reset(); |
| 840 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.SentFramesPerSecond")); | 840 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.SentFramesPerSecond")); |
| 841 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SentFramesPerSecond", kFps)); | 841 EXPECT_EQ(1, metrics::NumEvents("WebRTC.Video.SentFramesPerSecond", kFps)); |
| 842 } | 842 } |
| 843 | 843 |
| 844 TEST_F(SendStatisticsProxyTest, CpuLimitedResolutionUpdated) { | 844 TEST_F(SendStatisticsProxyTest, CpuLimitedHistogramNotUpdatedWhenDisabled) { |
| 845 const int kNumDownscales = -1; |
| 846 statistics_proxy_->SetQualityScalingStats(kNumDownscales); |
| 847 |
| 845 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) | 848 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
| 846 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); | 849 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
| 847 | 850 |
| 851 statistics_proxy_.reset(); |
| 852 EXPECT_EQ(0, |
| 853 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); |
| 854 } |
| 855 |
| 856 TEST_F(SendStatisticsProxyTest, CpuLimitedHistogramUpdated) { |
| 857 const int kNumDownscales = 0; |
| 858 statistics_proxy_->SetCpuScalingStats(kNumDownscales); |
| 859 |
| 860 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
| 861 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
| 862 |
| 848 statistics_proxy_->OnCpuRestrictedResolutionChanged(true); | 863 statistics_proxy_->OnCpuRestrictedResolutionChanged(true); |
| 849 | 864 |
| 850 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) | 865 for (int i = 0; i < SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) |
| 851 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); | 866 statistics_proxy_->OnIncomingFrame(kWidth, kHeight); |
| 852 | 867 |
| 853 statistics_proxy_.reset(); | 868 statistics_proxy_.reset(); |
| 854 EXPECT_EQ(1, | 869 EXPECT_EQ(1, |
| 855 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); | 870 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); |
| 856 EXPECT_EQ( | 871 EXPECT_EQ( |
| 857 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); | 872 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); | 1716 fake_clock_.AdvanceTimeMilliseconds(kPeriodIntervalMs); |
| 1702 proxy->DataCountersUpdated(counters, kFirstSsrc); | 1717 proxy->DataCountersUpdated(counters, kFirstSsrc); |
| 1703 } | 1718 } |
| 1704 | 1719 |
| 1705 // FEC not enabled. | 1720 // FEC not enabled. |
| 1706 statistics_proxy_.reset(); | 1721 statistics_proxy_.reset(); |
| 1707 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); | 1722 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.FecBitrateSentInKbps")); |
| 1708 } | 1723 } |
| 1709 | 1724 |
| 1710 } // namespace webrtc | 1725 } // namespace webrtc |
| OLD | NEW |