OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #include <string> |
| 11 |
| 12 #include "webrtc/test/call_test.h" |
| 13 #include "webrtc/test/frame_generator.h" |
| 14 #include "webrtc/test/testsupport/trace_to_stderr.h" |
| 15 |
| 16 namespace webrtc { |
| 17 namespace mod { |
| 18 |
| 19 class VideoQualityTest : public ::webrtc::test::CallTest { |
| 20 public: |
| 21 // Parameters are grouped into smaller structs to make it easier to set |
| 22 // the desired elements and skip unused, using aggregate initialization. |
| 23 // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs, |
| 24 // which makes the implementation of VideoQualityTest a bit uglier. |
| 25 struct Params { |
| 26 struct { |
| 27 size_t width; |
| 28 size_t height; |
| 29 int32_t fps; |
| 30 int min_bitrate_bps; |
| 31 int target_bitrate_bps; |
| 32 int max_bitrate_bps; |
| 33 std::string codec; |
| 34 size_t num_temporal_layers; |
| 35 |
| 36 int min_transmit_bps; |
| 37 Call::Config::BitrateConfig call_bitrate_config; |
| 38 size_t tl_discard_threshold; |
| 39 bool send_side_bwe; |
| 40 } common; |
| 41 struct { // Video-specific settings. |
| 42 std::string clip_name; |
| 43 } video; |
| 44 struct { // Screenshare-specific settings. |
| 45 bool enabled; |
| 46 int32_t slide_change_interval; |
| 47 int32_t scroll_duration; |
| 48 } screenshare; |
| 49 struct { // Analyzer settings. |
| 50 std::string test_label; |
| 51 double avg_psnr_threshold; |
| 52 double avg_ssim_threshold; |
| 53 int test_durations_secs; |
| 54 std::string graph_data_output_filename; |
| 55 } analyzer; |
| 56 FakeNetworkPipe::Config pipe; |
| 57 bool logs; |
| 58 }; |
| 59 |
| 60 VideoQualityTest(); |
| 61 void RunWithAnalyzer(const Params& params); |
| 62 void RunWithVideoRenderer(const Params& params); |
| 63 |
| 64 protected: |
| 65 // No-op implementation to be able to instantiate this class from non-TEST_F |
| 66 // locations. |
| 67 void TestBody() override; |
| 68 |
| 69 void CreateCapturer(const Params& params, VideoCaptureInput* input); |
| 70 void ValidateParams(const Params& params); |
| 71 void SetupFullStack(const Params& params, |
| 72 Transport* send_transport, |
| 73 Transport* recv_transport); |
| 74 void SetupScreenshare(const Params& params); |
| 75 |
| 76 // We need a more general capturer than the FrameGeneratorCapturer. |
| 77 rtc::scoped_ptr<test::VideoCapturer> capturer_; |
| 78 rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr_; |
| 79 rtc::scoped_ptr<test::FrameGenerator> frame_generator_; |
| 80 rtc::scoped_ptr<VideoEncoder> encoder_; |
| 81 VideoCodecUnion codec_settings_; |
| 82 Clock* const clock_; |
| 83 }; |
| 84 |
| 85 } // namespace mod; |
| 86 } // namespace webrtc |
| 87 |
| 88 /* |
| 89 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 90 * |
| 91 * Use of this source code is governed by a BSD-style license |
| 92 * that can be found in the LICENSE file in the root of the source |
| 93 * tree. An additional intellectual property rights grant can be found |
| 94 * in the file PATENTS. All contributing project authors may |
| 95 * be found in the AUTHORS file in the root of the source tree. |
| 96 */ |
10 #include <stdio.h> | 97 #include <stdio.h> |
11 | 98 |
12 #include <algorithm> | 99 #include <algorithm> |
13 #include <deque> | 100 #include <deque> |
14 #include <map> | 101 #include <map> |
15 #include <vector> | 102 #include <vector> |
16 | 103 |
17 #include "testing/gtest/include/gtest/gtest.h" | 104 #include "testing/gtest/include/gtest/gtest.h" |
18 | 105 |
19 #include "webrtc/base/checks.h" | 106 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/format_macros.h" | 107 #include "webrtc/base/format_macros.h" |
21 #include "webrtc/base/scoped_ptr.h" | 108 #include "webrtc/base/scoped_ptr.h" |
22 #include "webrtc/call.h" | 109 #include "webrtc/call.h" |
23 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 110 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
24 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" | 111 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" |
25 #include "webrtc/system_wrappers/interface/cpu_info.h" | 112 #include "webrtc/system_wrappers/interface/cpu_info.h" |
26 #include "webrtc/test/layer_filtering_transport.h" | 113 #include "webrtc/test/layer_filtering_transport.h" |
27 #include "webrtc/test/run_loop.h" | 114 #include "webrtc/test/run_loop.h" |
28 #include "webrtc/test/statistics.h" | 115 #include "webrtc/test/statistics.h" |
29 #include "webrtc/test/testsupport/fileutils.h" | 116 #include "webrtc/test/testsupport/fileutils.h" |
30 #include "webrtc/test/video_renderer.h" | 117 #include "webrtc/test/video_renderer.h" |
31 #include "webrtc/video/video_quality_test.h" | |
32 | 118 |
33 namespace webrtc { | 119 namespace webrtc { |
| 120 namespace mod { |
34 | 121 |
35 static const int kTransportSeqExtensionId = | 122 static const int kTransportSeqExtensionId = |
36 VideoQualityTest::kAbsSendTimeExtensionId + 1; | 123 VideoQualityTest::kAbsSendTimeExtensionId + 1; |
37 static const int kSendStatsPollingIntervalMs = 1000; | 124 static const int kSendStatsPollingIntervalMs = 1000; |
38 static const int kPayloadTypeVP8 = 123; | 125 static const int kPayloadTypeVP8 = 123; |
39 static const int kPayloadTypeVP9 = 124; | 126 static const int kPayloadTypeVP9 = 124; |
40 | 127 |
41 class VideoAnalyzer : public PacketReceiver, | 128 class VideoAnalyzer : public PacketReceiver, |
42 public Transport, | 129 public Transport, |
43 public VideoRenderer, | 130 public VideoRenderer, |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 capturer_->Stop(); | 918 capturer_->Stop(); |
832 send_stream_->Stop(); | 919 send_stream_->Stop(); |
833 receive_stream->Stop(); | 920 receive_stream->Stop(); |
834 | 921 |
835 call->DestroyVideoReceiveStream(receive_stream); | 922 call->DestroyVideoReceiveStream(receive_stream); |
836 call->DestroyVideoSendStream(send_stream_); | 923 call->DestroyVideoSendStream(send_stream_); |
837 | 924 |
838 transport.StopSending(); | 925 transport.StopSending(); |
839 } | 926 } |
840 | 927 |
| 928 } // namespace mod |
841 } // namespace webrtc | 929 } // namespace webrtc |
| 930 |
| 931 |
| 932 |
| 933 |
| 934 /* |
| 935 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 936 * |
| 937 * Use of this source code is governed by a BSD-style license |
| 938 * that can be found in the LICENSE file in the root of the source |
| 939 * tree. An additional intellectual property rights grant can be found |
| 940 * in the file PATENTS. All contributing project authors may |
| 941 * be found in the AUTHORS file in the root of the source tree. |
| 942 */ |
| 943 #include <stdio.h> |
| 944 |
| 945 #include "testing/gtest/include/gtest/gtest.h" |
| 946 |
| 947 namespace webrtc { |
| 948 |
| 949 static const int kFullStackTestDurationSecs = 60; |
| 950 |
| 951 class FullStackTestMod : public mod::VideoQualityTest { |
| 952 public: |
| 953 void RunTestMod(const VideoQualityTest::Params ¶ms) { |
| 954 RunWithAnalyzer(params); |
| 955 } |
| 956 }; |
| 957 |
| 958 |
| 959 // TEST_F(FullStackTestMod, ParisQcifWithoutPacketLoss) { |
| 960 // VideoQualityTest::Params paris_qcif = { |
| 961 // {176, 144, 30, 300000, 300000, 300000, "VP8", 1}, |
| 962 // {"paris_qcif"}, |
| 963 // {}, |
| 964 // {"net_delay_0_0_plr_0", 36.0, 0.96, kFullStackTestDurationSecs}}; |
| 965 // RunTestMod(paris_qcif); |
| 966 // } |
| 967 // |
| 968 // TEST_F(FullStackTestMod, ForemanCifWithoutPacketLoss) { |
| 969 // // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. |
| 970 // VideoQualityTest::Params foreman_cif = { |
| 971 // {352, 288, 30, 700000, 700000, 700000, "VP8", 1}, |
| 972 // {"foreman_cif"}, |
| 973 // {}, |
| 974 // {"foreman_cif_net_delay_0_0_plr_0", 0.0, 0.0, kFullStackTestDurationSec
s} |
| 975 // }; |
| 976 // RunTestMod(foreman_cif); |
| 977 // } |
| 978 // |
| 979 // TEST_F(FullStackTestMod, ForemanCifPlr5) { |
| 980 // VideoQualityTest::Params foreman_cif = { |
| 981 // {352, 288, 30, 30000, 500000, 2000000, "VP8", 1}, |
| 982 // {"foreman_cif"}, |
| 983 // {}, |
| 984 // {"foreman_cif_delay_50_0_plr_5", 0.0, 0.0, kFullStackTestDurationSecs}}
; |
| 985 // foreman_cif.pipe.loss_percent = 5; |
| 986 // foreman_cif.pipe.queue_delay_ms = 50; |
| 987 // RunTestMod(foreman_cif); |
| 988 // } |
| 989 // |
| 990 // TEST_F(FullStackTestMod, ForemanCif500kbps) { |
| 991 // VideoQualityTest::Params foreman_cif = { |
| 992 // {352, 288, 30, 30000, 500000, 2000000, "VP8", 1}, |
| 993 // {"foreman_cif"}, |
| 994 // {}, |
| 995 // {"foreman_cif_500kbps", 0.0, 0.0, kFullStackTestDurationSecs}}; |
| 996 // foreman_cif.pipe.queue_length_packets = 0; |
| 997 // foreman_cif.pipe.queue_delay_ms = 0; |
| 998 // foreman_cif.pipe.link_capacity_kbps = 500; |
| 999 // RunTestMod(foreman_cif); |
| 1000 // } |
| 1001 // |
| 1002 // TEST_F(FullStackTestMod, ForemanCif500kbpsLimitedQueue) { |
| 1003 // VideoQualityTest::Params foreman_cif = { |
| 1004 // {352, 288, 30, 30000, 500000, 2000000, "VP8", 1}, |
| 1005 // {"foreman_cif"}, |
| 1006 // {}, |
| 1007 // {"foreman_cif_500kbps_32pkts_queue", 0.0, 0.0, kFullStackTestDurationSe
cs} |
| 1008 // }; |
| 1009 // foreman_cif.pipe.queue_length_packets = 32; |
| 1010 // foreman_cif.pipe.queue_delay_ms = 0; |
| 1011 // foreman_cif.pipe.link_capacity_kbps = 500; |
| 1012 // RunTestMod(foreman_cif); |
| 1013 // } |
| 1014 // |
| 1015 // TEST_F(FullStackTestMod, ForemanCif500kbps100ms) { |
| 1016 // VideoQualityTest::Params foreman_cif = { |
| 1017 // {352, 288, 30, 30000, 500000, 2000000, "VP8", 1}, |
| 1018 // {"foreman_cif"}, |
| 1019 // {}, |
| 1020 // {"foreman_cif_500kbps_100ms", 0.0, 0.0, kFullStackTestDurationSecs}}; |
| 1021 // foreman_cif.pipe.queue_length_packets = 0; |
| 1022 // foreman_cif.pipe.queue_delay_ms = 100; |
| 1023 // foreman_cif.pipe.link_capacity_kbps = 500; |
| 1024 // RunTestMod(foreman_cif); |
| 1025 // } |
| 1026 // |
| 1027 // TEST_F(FullStackTestMod, ForemanCif500kbps100msLimitedQueue) { |
| 1028 // VideoQualityTest::Params foreman_cif = { |
| 1029 // {352, 288, 30, 30000, 500000, 2000000, "VP8", 1}, |
| 1030 // {"foreman_cif"}, |
| 1031 // {}, |
| 1032 // {"foreman_cif_500kbps_100ms_32pkts_queue", 0.0, 0.0, |
| 1033 // kFullStackTestDurationSecs}}; |
| 1034 // foreman_cif.pipe.queue_length_packets = 32; |
| 1035 // foreman_cif.pipe.queue_delay_ms = 100; |
| 1036 // foreman_cif.pipe.link_capacity_kbps = 500; |
| 1037 // RunTestMod(foreman_cif); |
| 1038 // } |
| 1039 // |
| 1040 // TEST_F(FullStackTestMod, ForemanCif1000kbps100msLimitedQueue) { |
| 1041 // VideoQualityTest::Params foreman_cif = { |
| 1042 // {352, 288, 30, 30000, 2000000, 2000000, "VP8", 1}, |
| 1043 // {"foreman_cif"}, |
| 1044 // {}, |
| 1045 // {"foreman_cif_1000kbps_100ms_32pkts_queue", 0.0, 0.0, |
| 1046 // kFullStackTestDurationSecs}}; |
| 1047 // foreman_cif.pipe.queue_length_packets = 32; |
| 1048 // foreman_cif.pipe.queue_delay_ms = 100; |
| 1049 // foreman_cif.pipe.link_capacity_kbps = 1000; |
| 1050 // RunTestMod(foreman_cif); |
| 1051 // } |
| 1052 // |
| 1053 // // Temporarily disabled on Android due to low test timeouts. |
| 1054 // // https://code.google.com/p/chromium/issues/detail?id=513170 |
| 1055 // #include "webrtc/test/testsupport/gtest_disable.h" |
| 1056 // TEST_F(FullStackTestMod, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) { |
| 1057 // VideoQualityTest::Params screenshare = { |
| 1058 // {1850, 1110, 5, 50000, 200000, 2000000, "VP8", 2, 400000}, |
| 1059 // {}, // Video-specific. |
| 1060 // {true, 10}, // Screenshare-specific. |
| 1061 // {"screenshare_slides", 0.0, 0.0, kFullStackTestDurationSecs}}; |
| 1062 // RunTestMod(screenshare); |
| 1063 // } |
| 1064 // |
| 1065 // TEST_F(FullStackTestMod, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL_Scroll)
) { |
| 1066 // VideoQualityTest::Params config = { |
| 1067 // {1850, 1110 / 2, 5, 50000, 200000, 2000000, "VP8", 2, 400000}, |
| 1068 // {}, |
| 1069 // {true, 10, 2}, |
| 1070 // {"screenshare_slides_scrolling", 0.0, 0.0, kFullStackTestDurationSecs}}
; |
| 1071 // RunTestMod(config); |
| 1072 // } |
| 1073 |
| 1074 #define SCREENSHARE_VP8_2TL { \ |
| 1075 VideoQualityTest::Params screenshare = { \ |
| 1076 {1850, 1110, 5, 50000, 200000, 2000000, "VP8", 2, 400000}, \ |
| 1077 {}, \ |
| 1078 {true, 10}, \ |
| 1079 {"screenshare_slides", 0.0, 0.0, kFullStackTestDurationSecs}}; \ |
| 1080 RunTestMod(screenshare); \ |
| 1081 } |
| 1082 |
| 1083 #define SCREENSHARE_VP9_2TL { \ |
| 1084 VideoQualityTest::Params screenshare = { \ |
| 1085 {1850, 1110, 5, 50000, 200000, 2000000, "VP9", 2, 400000}, \ |
| 1086 {}, \ |
| 1087 {true, 10}, \ |
| 1088 {"screenshare_slides_vp9_2tl", 0.0, 0.0, kFullStackTestDurationSecs}}; \ |
| 1089 RunTestMod(screenshare); \ |
| 1090 } |
| 1091 |
| 1092 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_0) SCREENSHARE_VP8_2TL; |
| 1093 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_1) SCREENSHARE_VP8_2TL; |
| 1094 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_2) SCREENSHARE_VP8_2TL; |
| 1095 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_3) SCREENSHARE_VP8_2TL; |
| 1096 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_4) SCREENSHARE_VP8_2TL; |
| 1097 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_5) SCREENSHARE_VP8_2TL; |
| 1098 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_6) SCREENSHARE_VP8_2TL; |
| 1099 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_7) SCREENSHARE_VP8_2TL; |
| 1100 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_8) SCREENSHARE_VP8_2TL; |
| 1101 TEST_F(FullStackTestMod, ScreenshareSlidesVP8_2TL_Mod_9) SCREENSHARE_VP8_2TL; |
| 1102 |
| 1103 } // namespace webrtc |
OLD | NEW |