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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 196 |
197 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderImplementationName) { | 197 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecoderImplementationName) { |
198 const char* kName = "decoderName"; | 198 const char* kName = "decoderName"; |
199 statistics_proxy_->OnDecoderImplementationName(kName); | 199 statistics_proxy_->OnDecoderImplementationName(kName); |
200 EXPECT_STREQ( | 200 EXPECT_STREQ( |
201 kName, statistics_proxy_->GetStats().decoder_implementation_name.c_str()); | 201 kName, statistics_proxy_->GetStats().decoder_implementation_name.c_str()); |
202 } | 202 } |
203 | 203 |
204 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsOnCompleteFrame) { | 204 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsOnCompleteFrame) { |
205 const int kFrameSizeBytes = 1000; | 205 const int kFrameSizeBytes = 1000; |
206 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes); | 206 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes, |
207 VideoContentType::UNSPECIFIED); | |
207 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); | 208 VideoReceiveStream::Stats stats = statistics_proxy_->GetStats(); |
208 EXPECT_EQ(1, stats.network_frame_rate); | 209 EXPECT_EQ(1, stats.network_frame_rate); |
209 EXPECT_EQ(1, stats.frame_counts.key_frames); | 210 EXPECT_EQ(1, stats.frame_counts.key_frames); |
210 EXPECT_EQ(0, stats.frame_counts.delta_frames); | 211 EXPECT_EQ(0, stats.frame_counts.delta_frames); |
211 } | 212 } |
212 | 213 |
213 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecodeTimingStats) { | 214 TEST_F(ReceiveStatisticsProxyTest, GetStatsReportsDecodeTimingStats) { |
214 const int kDecodeMs = 1; | 215 const int kDecodeMs = 1; |
215 const int kMaxDecodeMs = 2; | 216 const int kMaxDecodeMs = 2; |
216 const int kCurrentDelayMs = 3; | 217 const int kCurrentDelayMs = 3; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 statistics_proxy_.reset(); | 527 statistics_proxy_.reset(); |
527 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); | 528 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.Decoded.Vp8.Qp")); |
528 } | 529 } |
529 | 530 |
530 TEST_F(ReceiveStatisticsProxyTest, | 531 TEST_F(ReceiveStatisticsProxyTest, |
531 KeyFrameHistogramNotUpdatedForTooFewSamples) { | 532 KeyFrameHistogramNotUpdatedForTooFewSamples) { |
532 const bool kIsKeyFrame = false; | 533 const bool kIsKeyFrame = false; |
533 const int kFrameSizeBytes = 1000; | 534 const int kFrameSizeBytes = 1000; |
534 | 535 |
535 for (int i = 0; i < kMinRequiredSamples - 1; ++i) | 536 for (int i = 0; i < kMinRequiredSamples - 1; ++i) |
536 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes); | 537 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes, |
538 VideoContentType::UNSPECIFIED); | |
537 | 539 |
538 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); | 540 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); |
539 EXPECT_EQ(kMinRequiredSamples - 1, | 541 EXPECT_EQ(kMinRequiredSamples - 1, |
540 statistics_proxy_->GetStats().frame_counts.delta_frames); | 542 statistics_proxy_->GetStats().frame_counts.delta_frames); |
541 | 543 |
542 statistics_proxy_.reset(); | 544 statistics_proxy_.reset(); |
543 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); | 545 EXPECT_EQ(0, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
544 } | 546 } |
545 | 547 |
546 TEST_F(ReceiveStatisticsProxyTest, | 548 TEST_F(ReceiveStatisticsProxyTest, |
547 KeyFrameHistogramUpdatedForMinRequiredSamples) { | 549 KeyFrameHistogramUpdatedForMinRequiredSamples) { |
548 const bool kIsKeyFrame = false; | 550 const bool kIsKeyFrame = false; |
549 const int kFrameSizeBytes = 1000; | 551 const int kFrameSizeBytes = 1000; |
550 | 552 |
551 for (int i = 0; i < kMinRequiredSamples; ++i) | 553 for (int i = 0; i < kMinRequiredSamples; ++i) |
552 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes); | 554 statistics_proxy_->OnCompleteFrame(kIsKeyFrame, kFrameSizeBytes, |
555 VideoContentType::UNSPECIFIED); | |
553 | 556 |
554 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); | 557 EXPECT_EQ(0, statistics_proxy_->GetStats().frame_counts.key_frames); |
555 EXPECT_EQ(kMinRequiredSamples, | 558 EXPECT_EQ(kMinRequiredSamples, |
556 statistics_proxy_->GetStats().frame_counts.delta_frames); | 559 statistics_proxy_->GetStats().frame_counts.delta_frames); |
557 | 560 |
558 statistics_proxy_.reset(); | 561 statistics_proxy_.reset(); |
559 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); | 562 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
560 EXPECT_EQ(1, | 563 EXPECT_EQ(1, |
561 metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 0)); | 564 metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 0)); |
562 } | 565 } |
563 | 566 |
564 TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) { | 567 TEST_F(ReceiveStatisticsProxyTest, KeyFrameHistogramIsUpdated) { |
565 const int kFrameSizeBytes = 1000; | 568 const int kFrameSizeBytes = 1000; |
566 | 569 |
567 for (int i = 0; i < kMinRequiredSamples; ++i) | 570 for (int i = 0; i < kMinRequiredSamples; ++i) |
568 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes); | 571 statistics_proxy_->OnCompleteFrame(true, kFrameSizeBytes, |
572 VideoContentType::UNSPECIFIED); | |
569 | 573 |
570 for (int i = 0; i < kMinRequiredSamples; ++i) | 574 for (int i = 0; i < kMinRequiredSamples; ++i) |
571 statistics_proxy_->OnCompleteFrame(false, kFrameSizeBytes); | 575 statistics_proxy_->OnCompleteFrame(false, kFrameSizeBytes, |
576 VideoContentType::UNSPECIFIED); | |
572 | 577 |
573 EXPECT_EQ(kMinRequiredSamples, | 578 EXPECT_EQ(kMinRequiredSamples, |
574 statistics_proxy_->GetStats().frame_counts.key_frames); | 579 statistics_proxy_->GetStats().frame_counts.key_frames); |
575 EXPECT_EQ(kMinRequiredSamples, | 580 EXPECT_EQ(kMinRequiredSamples, |
576 statistics_proxy_->GetStats().frame_counts.delta_frames); | 581 statistics_proxy_->GetStats().frame_counts.delta_frames); |
577 | 582 |
578 statistics_proxy_.reset(); | 583 statistics_proxy_.reset(); |
579 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); | 584 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.KeyFramesReceivedInPermille")); |
580 EXPECT_EQ( | 585 EXPECT_EQ( |
581 1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 500)); | 586 1, metrics::NumEvents("WebRTC.Video.KeyFramesReceivedInPermille", 500)); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 } | 775 } |
771 // One extra with with double the interval. | 776 // One extra with with double the interval. |
772 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 777 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
773 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 778 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
774 | 779 |
775 statistics_proxy_.reset(); | 780 statistics_proxy_.reset(); |
776 const int kExpectedInterFrame = | 781 const int kExpectedInterFrame = |
777 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + | 782 (kInterFrameDelayMs * (kMinRequiredSamples - 1) + |
778 kInterFrameDelayMs * 2) / | 783 kInterFrameDelayMs * 2) / |
779 kMinRequiredSamples; | 784 kMinRequiredSamples; |
780 switch (content_type) { | 785 if (content_type.IsScreenshare()) { |
781 case VideoContentType::UNSPECIFIED: | 786 EXPECT_EQ( |
782 EXPECT_EQ(kExpectedInterFrame, | 787 kExpectedInterFrame, |
783 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 788 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
784 EXPECT_EQ(kInterFrameDelayMs * 2, | 789 EXPECT_EQ( |
785 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 790 kInterFrameDelayMs * 2, |
786 break; | 791 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
787 case VideoContentType::SCREENSHARE: | 792 } else { |
788 EXPECT_EQ( | 793 EXPECT_EQ(kExpectedInterFrame, |
789 kExpectedInterFrame, | 794 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
790 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 795 EXPECT_EQ(kInterFrameDelayMs * 2, |
791 EXPECT_EQ(kInterFrameDelayMs * 2, | 796 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
792 metrics::MinSample( | |
793 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | |
794 break; | |
795 default: | |
796 RTC_NOTREACHED(); | |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { | 800 TEST_P(ReceiveStatisticsProxyTest, MaxInterFrameDelayOnlyWithValidAverage) { |
801 const VideoContentType content_type = GetParam(); | 801 const VideoContentType content_type = GetParam(); |
802 const int kInterFrameDelayMs = 33; | 802 const int kInterFrameDelayMs = 33; |
803 for (int i = 0; i < kMinRequiredSamples; ++i) { | 803 for (int i = 0; i < kMinRequiredSamples; ++i) { |
804 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 804 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
805 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 805 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
806 } | 806 } |
(...skipping 22 matching lines...) Expand all Loading... | |
829 statistics_proxy_->OnStreamInactive(); | 829 statistics_proxy_->OnStreamInactive(); |
830 fake_clock_.AdvanceTimeMilliseconds(5000); | 830 fake_clock_.AdvanceTimeMilliseconds(5000); |
831 | 831 |
832 // Insert two more frames. The interval during the pause should be disregarded | 832 // Insert two more frames. The interval during the pause should be disregarded |
833 // in the stats. | 833 // in the stats. |
834 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 834 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
835 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | 835 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); |
836 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | 836 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); |
837 | 837 |
838 statistics_proxy_.reset(); | 838 statistics_proxy_.reset(); |
839 if (content_type == VideoContentType::SCREENSHARE) { | 839 if (content_type.IsScreenshare()) { |
840 EXPECT_EQ( | 840 EXPECT_EQ( |
841 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 841 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
842 EXPECT_EQ(1, metrics::NumSamples( | 842 EXPECT_EQ(1, metrics::NumSamples( |
843 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | 843 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
844 EXPECT_EQ( | 844 EXPECT_EQ( |
845 kInterFrameDelayMs, | 845 kInterFrameDelayMs, |
846 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); | 846 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayInMs")); |
847 EXPECT_EQ( | 847 EXPECT_EQ( |
848 kInterFrameDelayMs, | 848 kInterFrameDelayMs, |
849 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | 849 metrics::MinSample("WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); |
850 } else { | 850 } else { |
851 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); | 851 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); |
852 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); | 852 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); |
853 EXPECT_EQ(kInterFrameDelayMs, | 853 EXPECT_EQ(kInterFrameDelayMs, |
854 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); | 854 metrics::MinSample("WebRTC.Video.InterframeDelayInMs")); |
855 EXPECT_EQ(kInterFrameDelayMs, | 855 EXPECT_EQ(kInterFrameDelayMs, |
856 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); | 856 metrics::MinSample("WebRTC.Video.InterframeDelayMaxInMs")); |
857 } | 857 } |
858 } | 858 } |
859 | 859 |
860 TEST_P(ReceiveStatisticsProxyTest, StatsAreSlicedOnSimulcastAndExperiment) { | |
861 VideoContentType content_type = GetParam(); | |
862 const uint8_t experiment_id = 1; | |
863 content_type.SetExperimentId(experiment_id); | |
864 const int kInterFrameDelayMs = 33; | |
865 | |
866 content_type.SetSimulcastId(1); | |
867 for (int i = 0; i <= kMinRequiredSamples; ++i) { | |
868 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | |
869 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | |
870 } | |
871 | |
872 content_type.SetSimulcastId(2); | |
873 for (int i = 0; i <= kMinRequiredSamples; ++i) { | |
874 statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), content_type); | |
875 fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs); | |
876 } | |
877 statistics_proxy_.reset(); | |
878 | |
879 if (content_type.IsScreenshare()) { | |
880 EXPECT_EQ( | |
881 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs")); | |
882 EXPECT_EQ(1, metrics::NumSamples( | |
883 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs")); | |
884 EXPECT_EQ(1, metrics::NumSamples( | |
885 "WebRTC.Video.Screenshare.InterframeDelayInMs.S0")); | |
886 EXPECT_EQ(1, metrics::NumSamples( | |
887 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S0")); | |
888 EXPECT_EQ(1, metrics::NumSamples( | |
889 "WebRTC.Video.Screenshare.InterframeDelayInMs.S1")); | |
890 EXPECT_EQ(1, metrics::NumSamples( | |
891 "WebRTC.Video.Screenshare.InterframeDelayMaxInMs.S1")); | |
892 EXPECT_EQ(1, | |
893 metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayInMs" | |
894 ".ExperimentGroup0")); | |
895 EXPECT_EQ( | |
896 1, metrics::NumSamples("WebRTC.Video.Screenshare.InterframeDelayMaxInMs" | |
897 ".ExperimentGroup0")); | |
898 } else { | |
899 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs")); | |
900 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs")); | |
901 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S0")); | |
902 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S0")); | |
903 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs.S1")); | |
904 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs.S1")); | |
905 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayInMs" | |
906 ".ExperimentGroup0")); | |
907 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.InterframeDelayMaxInMs" | |
908 ".ExperimentGroup0")); | |
909 } | |
sprang_webrtc
2017/08/28 16:25:02
Can you verify the actual values for any of these
ilnik
2017/08/29 07:56:27
Done.
| |
910 } | |
911 | |
860 } // namespace webrtc | 912 } // namespace webrtc |
OLD | NEW |