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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 } | 733 } |
734 // One extra with with double the interval. | 734 // One extra with with double the interval. |
735 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 735 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
736 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 736 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
737 | 737 |
738 statistics_proxy_.reset(); | 738 statistics_proxy_.reset(); |
739 const int kExpectedInterFrame = | 739 const int kExpectedInterFrame = |
740 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + | 740 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + |
741 kInterFrameDelayMs * 2) / | 741 kInterFrameDelayMs * 2) / |
742 kMinRequiredSamples; | 742 kMinRequiredSamples; |
743 switch (content_type) { | 743 if (content_type == VideoContentType::UNSPECIFIED) { |
744 case VideoContentType::UNSPECIFIED: | 744 EXPECT_EQ(kExpectedInterFrame, |
745 EXPECT_EQ(kExpectedInterFrame, | 745 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
746 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 746 EXPECT_EQ(kInterFrameDelayMs * 2, |
747 EXPECT_EQ(kInterFrameDelayMs * 2, | 747 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
748 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 748 } else if (content_type == VideoContentType::SCREENSHARE) { |
749 break; | 749 EXPECT_EQ( |
750 case VideoContentType::SCREENSHARE: | 750 kExpectedInterFrame, |
751 EXPECT_EQ( | 751 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
752 kExpectedInterFrame, | 752 EXPECT_EQ( |
753 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 753 kInterFrameDelayMs * 2, |
754 EXPECT_EQ(kInterFrameDelayMs * 2, | 754 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
755 metrics::MinSample( | 755 } else { |
756 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | 756 RTC_NOTREACHED(); |
757 break; | |
758 default: | |
759 RTC_NOTREACHED(); | |
760 } | 757 } |
761 } | 758 } |
762 | 759 |
763 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { | 760 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { |
764 const VideoContentType content_type = GetParam(); | 761 const VideoContentType content_type = GetParam(); |
765 const int kInterFrameDelayMs = 33; | 762 const int kInterFrameDelayMs = 33; |
766 for (int i = 0; i < kMinRequiredSamples; ++i) { | 763 for (int i = 0; i < kMinRequiredSamples; ++i) { |
767 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 764 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
768 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 765 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
769 } | 766 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } else { | 810 } else { |
814 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); | 811 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); |
815 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); | 812 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); |
816 EXPECT_EQ(kInterFrameDelayMs, | 813 EXPECT_EQ(kInterFrameDelayMs, |
817 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 814 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
818 EXPECT_EQ(kInterFrameDelayMs, | 815 EXPECT_EQ(kInterFrameDelayMs, |
819 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 816 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
820 } | 817 } |
821 } | 818 } |
822 | 819 |
| 820 TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) { |
| 821 VideoContentType content_type = GetParam(); |
| 822 const uint8_t experiment_id = 1; |
| 823 content_type.SetExperimentId(experiment_id); |
| 824 const int kInterFrameDelayMs = 33; |
| 825 |
| 826 content_type.SetSimulcastId(1); |
| 827 for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| 828 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| 829 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| 830 } |
| 831 |
| 832 content_type.SetSimulcastId(2); |
| 833 for (int i = 0; i <= kMinRequiredSamples; ++i) { |
| 834 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
| 835 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
| 836 } |
| 837 statistics_proxy_.reset(); |
| 838 EXPECT_EQ( |
| 839 0, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
| 840 EXPECT_EQ(0, metrics::NumSamples( |
| 841 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
| 842 if (content_type.IsScreenshare()) { |
| 843 EXPECT_EQ(1, metrics::NumSamples( |
| 844 "WebRTC.Video.Screenshare.InterframeDelayInMs.S0")); |
| 845 EXPECT_EQ(1, metrics::NumSamples( |
| 846 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S0")); |
| 847 EXPECT_EQ(1, metrics::NumSamples( |
| 848 "WebRTC.Video.Screenshare.InterframeDelayInMs.S1")); |
| 849 EXPECT_EQ(1, metrics::NumSamples( |
| 850 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S1")); |
| 851 EXPECT_EQ(1, |
| 852 metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs" |
| 853 ".ExperimentGroup0")); |
| 854 EXPECT_EQ( |
| 855 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayMaxInMs" |
| 856 ".ExperimentGroup0")); |
| 857 } else { |
| 858 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S0")); |
| 859 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S0")); |
| 860 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S1")); |
| 861 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S1")); |
| 862 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs" |
| 863 ".ExperimentGroup0")); |
| 864 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs" |
| 865 ".ExperimentGroup0")); |
| 866 } |
| 867 } |
| 868 |
823 } // namespace webrtc | 869 } // namespace webrtc |
OLD | NEW |