OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 } | 770 } |
771 // One extra with with double the interval. | 771 // One extra with with double the interval. |
772 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 772 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
773 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 773 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
774 | 774 |
775 statistics_proxy_.reset(); | 775 statistics_proxy_.reset(); |
776 const int kExpectedInterFrame = | 776 const int kExpectedInterFrame = |
777 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + | 777 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + |
778 kInterFrameDelayMs * 2) / | 778 kInterFrameDelayMs * 2) / |
779 kMinRequiredSamples; | 779 kMinRequiredSamples; |
780 switch (content_type) { | 780 EXPECT_EQ(kExpectedInterFrame, |
781 case VideoContentType::UNSPECIFIED: | 781 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
782 EXPECT_EQ(kExpectedInterFrame, | 782 EXPECT_EQ(kInterFrameDelayMs * 2, |
783 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 783 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
784 EXPECT_EQ(kInterFrameDelayMs * 2, | |
785 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | |
786 break; | |
787 case VideoContentType::SCREENSHARE: | |
788 EXPECT_EQ( | |
789 kExpectedInterFrame, | |
790 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); | |
791 EXPECT_EQ(kInterFrameDelayMs * 2, | |
792 metrics::MinSample( | |
793 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | |
794 break; | |
795 default: | |
796 RTC_NOTREACHED(); | |
797 } | |
798 } | 784 } |
799 | 785 |
800 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { | 786 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { |
801 const VideoContentType content_type = GetParam(); | 787 const VideoContentType content_type = GetParam(); |
802 const int kInterFrameDelayMs = 33; | 788 const int kInterFrameDelayMs = 33; |
803 for (int i = 0; i < kMinRequiredSamples; ++i) { | 789 for (int i = 0; i < kMinRequiredSamples; ++i) { |
804 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 790 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
805 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 791 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
806 } | 792 } |
807 | 793 |
(...skipping 21 matching lines...) Expand all Loading... |
829 statistics_proxy_->OnStreamInactive(); | 815 statistics_proxy_->OnStreamInactive(); |
830 fake_clock_.AdvanceTimeMilliseconds(5000); | 816 fake_clock_.AdvanceTimeMilliseconds(5000); |
831 | 817 |
832 // Insert two more frames. The interval during the pause should be disregarded | 818 // Insert two more frames. The interval during the pause should be disregarded |
833 // in the stats. | 819 // in the stats. |
834 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 820 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
835 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 821 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
836 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 822 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
837 | 823 |
838 statistics_proxy_.reset(); | 824 statistics_proxy_.reset(); |
839 if (content_type == VideoContentType::SCREENSHARE) { | 825 |
| 826 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); |
| 827 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); |
| 828 EXPECT_EQ(kInterFrameDelayMs, |
| 829 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
| 830 EXPECT_EQ(kInterFrameDelayMs, |
| 831 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
| 832 } |
| 833 |
| 834 TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) { |
| 835 VideoContentType content_type = GetParam(); |
| 836 const uint8_t experiment_id = 1; |
| 837 content_type.SetExperimentId(experiment_id); |
| 838 const int kInterFrameDelayMs = 33; |
| 839 |
| 840 content_type.SetSimulcastId(1); |
| 841 for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| 842 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| 843 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| 844 } |
| 845 |
| 846 content_type.SetSimulcastId(2); |
| 847 for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| 848 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| 849 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| 850 } |
| 851 statistics_proxy_.reset(); |
| 852 EXPECT_EQ( |
| 853 0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
| 854 EXPECT_EQ(0, metrics::NumSamples( |
| 855 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
| 856 if (content_type.IsScreenshare()) { |
| 857 EXPECT_EQ(1, metrics::NumSamples( |
| 858 "WebRTC.Video.Screenshare.InterframeDelayInMs.S0")); |
| 859 EXPECT_EQ(1, metrics::NumSamples( |
| 860 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S0")); |
| 861 EXPECT_EQ(1, metrics::NumSamples( |
| 862 "WebRTC.Video.Screenshare.InterframeDelayInMs.S1")); |
| 863 EXPECT_EQ(1, metrics::NumSamples( |
| 864 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S1")); |
| 865 EXPECT_EQ(1, |
| 866 metrics::NumSamples("WebRTC.Video.InterframeDelayInMs" |
| 867 ".ExperimentGroup0")); |
840 EXPECT_EQ( | 868 EXPECT_EQ( |
841 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 869 1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs" |
842 EXPECT_EQ(1, metrics::NumSamples( | 870 ".ExperimentGroup0")); |
843 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | |
844 EXPECT_EQ( | |
845 kInterFrameDelayMs, | |
846 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); | |
847 EXPECT_EQ( | |
848 kInterFrameDelayMs, | |
849 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | |
850 } else { | 871 } else { |
851 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); | 872 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S0")); |
852 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); | 873 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S0")); |
853 EXPECT_EQ(kInterFrameDelayMs, | 874 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S1")); |
854 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 875 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S1")); |
855 EXPECT_EQ(kInterFrameDelayMs, | 876 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs" |
856 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 877 ".ExperimentGroup0")); |
| 878 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs" |
| 879 ".ExperimentGroup0")); |
857 } | 880 } |
858 } | 881 } |
859 | 882 |
860 } // namespace webrtc | 883 } // namespace webrtc |
OLD | NEW |