1/*
2 *  Copyright (c) 2013 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#include <stdio.h>
11
12#include "testing/gtest/include/gtest/gtest.h"
13#include "webrtc/video/video_quality_test.h"
14
15namespace webrtc {
16
17static const int kFullStackTestDurationSecs = 60;
18
19class FullStackTest : public VideoQualityTest {
20 public:
21  void RunTest(const VideoQualityTest::Params &params) {
22    RunWithAnalyzer(params);
23  }
24};
25
26// VideoQualityTest::Params params = {
27//   { ... },      // Common.
28//   { ... },      // Video-specific settings.
29//   { ... },      // Screenshare-specific settings.
30//   { ... },      // Analyzer settings.
31//   pipe,         // FakeNetworkPipe::Config
32//   { ... },      // Spatial scalability.
33//   logs          // bool
34// };
35
36TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) {
37  VideoQualityTest::Params paris_qcif = {
38      {176, 144, 30, 300000, 300000, 300000, "VP8", 1},
39      {"paris_qcif"},
40      {},
41      {"net_delay_0_0_plr_0", 36.0, 0.96, kFullStackTestDurationSecs}};
42  RunTest(paris_qcif);
43}
44
45TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) {
46  // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif.
47  VideoQualityTest::Params foreman_cif = {
48      {352, 288, 30, 700000, 700000, 700000, "VP8", 1},
49      {"foreman_cif"},
50      {},
51      {"foreman_cif_net_delay_0_0_plr_0", 0.0, 0.0, kFullStackTestDurationSecs}
52  };
53  RunTest(foreman_cif);
54}
55
56TEST_F(FullStackTest, ForemanCifPlr5) {
57  VideoQualityTest::Params foreman_cif = {
58      {352, 288, 30, 30000, 500000, 2000000, "VP8", 1},
59      {"foreman_cif"},
60      {},
61      {"foreman_cif_delay_50_0_plr_5", 0.0, 0.0, kFullStackTestDurationSecs}};
62  foreman_cif.pipe.loss_percent = 5;
63  foreman_cif.pipe.queue_delay_ms = 50;
64  RunTest(foreman_cif);
65}
66
67TEST_F(FullStackTest, ForemanCif500kbps) {
68  VideoQualityTest::Params foreman_cif = {
69      {352, 288, 30, 30000, 500000, 2000000, "VP8", 1},
70      {"foreman_cif"},
71      {},
72      {"foreman_cif_500kbps", 0.0, 0.0, kFullStackTestDurationSecs}};
73  foreman_cif.pipe.queue_length_packets = 0;
74  foreman_cif.pipe.queue_delay_ms = 0;
75  foreman_cif.pipe.link_capacity_kbps = 500;
76  RunTest(foreman_cif);
77}
78
79TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) {
80  VideoQualityTest::Params foreman_cif = {
81      {352, 288, 30, 30000, 500000, 2000000, "VP8", 1},
82      {"foreman_cif"},
83      {},
84      {"foreman_cif_500kbps_32pkts_queue", 0.0, 0.0, kFullStackTestDurationSecs}
85  };
86  foreman_cif.pipe.queue_length_packets = 32;
87  foreman_cif.pipe.queue_delay_ms = 0;
88  foreman_cif.pipe.link_capacity_kbps = 500;
89  RunTest(foreman_cif);
90}
91
92TEST_F(FullStackTest, ForemanCif500kbps100ms) {
93  VideoQualityTest::Params foreman_cif = {
94      {352, 288, 30, 30000, 500000, 2000000, "VP8", 1},
95      {"foreman_cif"},
96      {},
97      {"foreman_cif_500kbps_100ms", 0.0, 0.0, kFullStackTestDurationSecs}};
98  foreman_cif.pipe.queue_length_packets = 0;
99  foreman_cif.pipe.queue_delay_ms = 100;
100  foreman_cif.pipe.link_capacity_kbps = 500;
101  RunTest(foreman_cif);
102}
103
104TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) {
105  VideoQualityTest::Params foreman_cif = {
106      {352, 288, 30, 30000, 500000, 2000000, "VP8", 1},
107      {"foreman_cif"},
108      {},
109      {"foreman_cif_500kbps_100ms_32pkts_queue", 0.0, 0.0,
110        kFullStackTestDurationSecs}};
111  foreman_cif.pipe.queue_length_packets = 32;
112  foreman_cif.pipe.queue_delay_ms = 100;
113  foreman_cif.pipe.link_capacity_kbps = 500;
114  RunTest(foreman_cif);
115}
116
117TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) {
118  VideoQualityTest::Params foreman_cif = {
119      {352, 288, 30, 30000, 2000000, 2000000, "VP8", 1},
120      {"foreman_cif"},
121      {},
122      {"foreman_cif_1000kbps_100ms_32pkts_queue", 0.0, 0.0,
123        kFullStackTestDurationSecs}};
124  foreman_cif.pipe.queue_length_packets = 32;
125  foreman_cif.pipe.queue_delay_ms = 100;
126  foreman_cif.pipe.link_capacity_kbps = 1000;
127  RunTest(foreman_cif);
128}
129
130TEST_F(FullStackTest, ScreenshareSlidesVP8_2TL) {
131  VideoQualityTest::Params screenshare = {
132      {1850, 1110, 5, 50000, 200000, 2000000, "VP8", 2, 1, 400000},
133      {},
134      {true, 10},
135      {"screenshare_slides", 0.0, 0.0, kFullStackTestDurationSecs}};
136  RunTest(screenshare);
137}
138
139TEST_F(FullStackTest, ScreenshareSlidesVP8_2TL_Scroll) {
140  VideoQualityTest::Params config = {
141      {1850, 1110 / 2, 5, 50000, 200000, 2000000, "VP8", 2, 1, 400000},
142      {},
143      {true, 10, 2},
144      {"screenshare_slides_scrolling", 0.0, 0.0, kFullStackTestDurationSecs}};
145  RunTest(config);
146}
147
148TEST_F(FullStackTest, ScreenshareSlidesVP8_2TL_LossyNet) {
149  VideoQualityTest::Params screenshare = {
150      {1850, 1110, 5, 50000, 200000, 2000000, "VP8", 2, 1, 400000},
151      {},          // Video-specific.
152      {true, 10},  // Screenshare-specific.
153      {"screenshare_slides_lossy_net", 0.0, 0.0, kFullStackTestDurationSecs}};
154  screenshare.pipe.loss_percent = 5;
155  screenshare.pipe.queue_delay_ms = 200;
156  screenshare.pipe.link_capacity_kbps = 500;
157  RunTest(screenshare);
158}
159
160TEST_F(FullStackTest, ScreenshareSlidesVP8_2TL_VeryLossyNet) {
161  VideoQualityTest::Params screenshare = {
162      {1850, 1110, 5, 50000, 200000, 2000000, "VP8", 2, 1, 400000},
163      {},          // Video-specific.
164      {true, 10},  // Screenshare-specific.
165      {"screenshare_slides_very_lossy", 0.0, 0.0, kFullStackTestDurationSecs}};
166  screenshare.pipe.loss_percent = 10;
167  screenshare.pipe.queue_delay_ms = 200;
168  screenshare.pipe.link_capacity_kbps = 500;
169  RunTest(screenshare);
170}
171
172TEST_F(FullStackTest, ScreenshareSlidesVP9_2SL) {
173  VideoQualityTest::Params screenshare = {
174      {1850, 1110, 5, 50000, 200000, 2000000, "VP9", 1, 0, 400000},
175      {},
176      {true, 10},
177      {"screenshare_slides_vp9_2sl", 0.0, 0.0, kFullStackTestDurationSecs},
178      {},
179      false,
180      {std::vector<VideoStream>(), 0, 2, 1}};
181  RunTest(screenshare);
182}
183}  // namespace webrtc
184