blob: 52ac9e40d9ffbdda18b350e967890a3cfb35d0b7 [file] [log] [blame]
ivica5d6a06c2015-09-17 05:30:24 -07001/*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10#ifndef WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_
11#define WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_
12
13#include <string>
14
15#include "webrtc/test/call_test.h"
16#include "webrtc/test/frame_generator.h"
17#include "webrtc/test/testsupport/trace_to_stderr.h"
18
19namespace webrtc {
20
21class VideoQualityTest : public test::CallTest {
22 public:
23 // Parameters are grouped into smaller structs to make it easier to set
24 // the desired elements and skip unused, using aggregate initialization.
25 // Unfortunately, C++11 (as opposed to C11) doesn't support unnamed structs,
26 // which makes the implementation of VideoQualityTest a bit uglier.
27 struct Params {
28 struct {
29 size_t width;
30 size_t height;
31 int32_t fps;
32 int min_bitrate_bps;
33 int target_bitrate_bps;
34 int max_bitrate_bps;
35 std::string codec;
36 size_t num_temporal_layers;
37
38 int min_transmit_bps;
39 Call::Config::BitrateConfig call_bitrate_config;
40 size_t tl_discard_threshold;
sprangef165ee2015-09-22 05:10:52 -070041 bool send_side_bwe;
ivica5d6a06c2015-09-17 05:30:24 -070042 } common;
43 struct { // Video-specific settings.
44 std::string clip_name;
45 } video;
46 struct { // Screenshare-specific settings.
47 bool enabled;
48 int32_t slide_change_interval;
49 int32_t scroll_duration;
50 } screenshare;
51 struct { // Analyzer settings.
52 std::string test_label;
53 double avg_psnr_threshold;
54 double avg_ssim_threshold;
55 int test_durations_secs;
56 std::string graph_data_output_filename;
57 } analyzer;
58 FakeNetworkPipe::Config pipe;
59 bool logs;
60 };
61
62 VideoQualityTest();
63 void RunWithAnalyzer(const Params& params);
64 void RunWithVideoRenderer(const Params& params);
65
66 protected:
67 // No-op implementation to be able to instantiate this class from non-TEST_F
68 // locations.
69 void TestBody() override;
70
71 void CreateCapturer(const Params& params, VideoCaptureInput* input);
72 void ValidateParams(const Params& params);
73 void SetupFullStack(const Params& params,
74 newapi::Transport* send_transport,
75 newapi::Transport* recv_transport);
76 void SetupScreenshare(const Params& params);
77
ivica2d4e6c52015-09-23 01:57:06 -070078 // We need a more general capturer than the FrameGeneratorCapturer.
79 rtc::scoped_ptr<test::VideoCapturer> capturer_;
ivica5d6a06c2015-09-17 05:30:24 -070080 rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr_;
81 rtc::scoped_ptr<test::FrameGenerator> frame_generator_;
82 rtc::scoped_ptr<VideoEncoder> encoder_;
83 VideoCodecUnion codec_settings_;
84 Clock* const clock_;
85};
86
87} // namespace webrtc
88
89#endif // WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_