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 #ifndef WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ | 10 #ifndef WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ |
11 #define WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ | 11 #define WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "webrtc/test/call_test.h" | 15 #include "webrtc/test/call_test.h" |
16 #include "webrtc/test/frame_generator.h" | 16 #include "webrtc/test/frame_generator.h" |
17 #include "webrtc/test/testsupport/trace_to_stderr.h" | 17 #include "webrtc/test/testsupport/trace_to_stderr.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 #define AUTO_GRAPH_TITLE "__AUTO__" | |
sprang_webrtc
2015/10/05 11:14:40
Not sure about this. You're using this just to get
ivica
2015/10/05 12:11:17
You are right, this is unnecessary. Probably no on
| |
22 | |
21 class VideoQualityTest : public test::CallTest { | 23 class VideoQualityTest : public test::CallTest { |
22 public: | 24 public: |
23 // Parameters are grouped into smaller structs to make it easier to set | 25 // Parameters are grouped into smaller structs to make it easier to set |
24 // the desired elements and skip unused, using aggregate initialization. | 26 // the desired elements and skip unused, using aggregate initialization. |
25 // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs, | 27 // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs, |
26 // which makes the implementation of VideoQualityTest a bit uglier. | 28 // which makes the implementation of VideoQualityTest a bit uglier. |
27 struct Params { | 29 struct Params { |
28 struct { | 30 struct { |
29 size_t width; | 31 size_t width; |
30 size_t height; | 32 size_t height; |
31 int32_t fps; | 33 int32_t fps; |
32 int min_bitrate_bps; | 34 int min_bitrate_bps; |
33 int target_bitrate_bps; | 35 int target_bitrate_bps; |
34 int max_bitrate_bps; | 36 int max_bitrate_bps; |
35 std::string codec; | 37 std::string codec; |
36 size_t num_temporal_layers; | 38 int num_temporal_layers; |
39 int selected_tl; | |
40 int min_transmit_bps; | |
37 | 41 |
38 int min_transmit_bps; | |
39 Call::Config::BitrateConfig call_bitrate_config; | 42 Call::Config::BitrateConfig call_bitrate_config; |
40 size_t tl_discard_threshold; | |
41 bool send_side_bwe; | 43 bool send_side_bwe; |
42 } common; | 44 } common; |
43 struct { // Video-specific settings. | 45 struct { // Video-specific settings. |
44 std::string clip_name; | 46 std::string clip_name; |
45 } video; | 47 } video; |
46 struct { // Screenshare-specific settings. | 48 struct { // Screenshare-specific settings. |
47 bool enabled; | 49 bool enabled; |
48 int32_t slide_change_interval; | 50 int32_t slide_change_interval; |
49 int32_t scroll_duration; | 51 int32_t scroll_duration; |
50 } screenshare; | 52 } screenshare; |
51 struct { // Analyzer settings. | 53 struct { // Analyzer settings. |
52 std::string test_label; | 54 std::string test_label; |
53 double avg_psnr_threshold; | 55 double avg_psnr_threshold; // (*) |
54 double avg_ssim_threshold; | 56 double avg_ssim_threshold; // (*) |
55 int test_durations_secs; | 57 int test_durations_secs; |
56 std::string graph_data_output_filename; | 58 std::string graph_data_output_filename; |
59 std::string graph_title; | |
57 } analyzer; | 60 } analyzer; |
58 FakeNetworkPipe::Config pipe; | 61 FakeNetworkPipe::Config pipe; |
59 bool logs; | 62 bool logs; |
63 struct { // Spatial scalability. | |
64 std::vector<VideoStream> streams; // If empty, one stream is assumed. | |
65 size_t selected_stream; | |
66 int num_spatial_layers; | |
67 int selected_sl; | |
68 // If empty, bitrates are generated in VP9Impl automatically. | |
69 std::vector<SpatialLayer> spatial_layers; | |
70 } ss; | |
60 }; | 71 }; |
72 // (*) Set to -1.1 if generating graph data for simulcast or SVC and the | |
73 // selected stream/layer doesn't have the same resolution as the largest | |
74 // stream/layer (to ignore the PSNR and SSIM calculation errors). | |
61 | 75 |
62 VideoQualityTest(); | 76 VideoQualityTest(); |
63 void RunWithAnalyzer(const Params& params); | 77 void RunWithAnalyzer(const Params& params); |
64 void RunWithVideoRenderer(const Params& params); | 78 void RunWithVideoRenderer(const Params& params); |
65 | 79 |
80 static void FillScalabilitySettings( | |
81 Params* params, | |
82 const std::vector<std::string>& stream_descriptors, | |
83 size_t selected_stream, | |
84 int num_spatial_layers, | |
85 int selected_sl, | |
86 const std::vector<std::string>& sl_descriptors); | |
66 protected: | 87 protected: |
67 // No-op implementation to be able to instantiate this class from non-TEST_F | 88 // No-op implementation to be able to instantiate this class from non-TEST_F |
68 // locations. | 89 // locations. |
69 void TestBody() override; | 90 void TestBody() override; |
70 | 91 |
71 void CreateCapturer(const Params& params, VideoCaptureInput* input); | 92 // Helper methods accessing only params_. |
72 void ValidateParams(const Params& params); | 93 std::string GenerateGraphTitle() const; |
73 void SetupFullStack(const Params& params, | 94 void CheckParams(); |
74 Transport* send_transport, | 95 |
75 Transport* recv_transport); | 96 // Helper static methods. |
76 void SetupScreenshare(const Params& params); | 97 static VideoStream DefaultVideoStream(const Params& params); |
98 static std::vector<int> ParseCSV(const std::string& str); | |
99 | |
100 // Helper methods for setting up the call. | |
101 void CreateCapturer(VideoCaptureInput* input); | |
102 void SetupCommon(Transport* send_transport, Transport* recv_transport); | |
103 void SetupScreenshare(); | |
77 | 104 |
78 // We need a more general capturer than the FrameGeneratorCapturer. | 105 // We need a more general capturer than the FrameGeneratorCapturer. |
79 rtc::scoped_ptr<test::VideoCapturer> capturer_; | 106 rtc::scoped_ptr<test::VideoCapturer> capturer_; |
80 rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr_; | 107 rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr_; |
81 rtc::scoped_ptr<test::FrameGenerator> frame_generator_; | 108 rtc::scoped_ptr<test::FrameGenerator> frame_generator_; |
82 rtc::scoped_ptr<VideoEncoder> encoder_; | 109 rtc::scoped_ptr<VideoEncoder> encoder_; |
83 VideoCodecUnion codec_settings_; | 110 VideoCodecUnion codec_settings_; |
84 Clock* const clock_; | 111 Clock* const clock_; |
112 | |
113 Params params_; | |
85 }; | 114 }; |
86 | 115 |
87 } // namespace webrtc | 116 } // namespace webrtc |
88 | 117 |
89 #endif // WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ | 118 #endif // WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_ |
OLD | NEW |