blob: d606de7cace28906c1df58f41cfd8cc29da58618 [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;
41 } common;
42 struct { // Video-specific settings.
43 std::string clip_name;
44 } video;
45 struct { // Screenshare-specific settings.
46 bool enabled;
47 int32_t slide_change_interval;
48 int32_t scroll_duration;
49 } screenshare;
50 struct { // Analyzer settings.
51 std::string test_label;
52 double avg_psnr_threshold;
53 double avg_ssim_threshold;
54 int test_durations_secs;
55 std::string graph_data_output_filename;
56 } analyzer;
57 FakeNetworkPipe::Config pipe;
58 bool logs;
59 };
60
61 VideoQualityTest();
62 void RunWithAnalyzer(const Params& params);
63 void RunWithVideoRenderer(const Params& params);
64
65 protected:
66 // No-op implementation to be able to instantiate this class from non-TEST_F
67 // locations.
68 void TestBody() override;
69
70 void CreateCapturer(const Params& params, VideoCaptureInput* input);
71 void ValidateParams(const Params& params);
72 void SetupFullStack(const Params& params,
73 newapi::Transport* send_transport,
74 newapi::Transport* recv_transport);
75 void SetupScreenshare(const Params& params);
76
77 rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr_;
78 rtc::scoped_ptr<test::FrameGenerator> frame_generator_;
79 rtc::scoped_ptr<VideoEncoder> encoder_;
80 VideoCodecUnion codec_settings_;
81 Clock* const clock_;
82};
83
84} // namespace webrtc
85
86#endif // WEBRTC_VIDEO_VIDEO_QUALITY_TEST_H_