blob: 1e47d05b61c1f89bcfcbe71b89345660cdb9f571 [file] [log] [blame]
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +00001/*
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 <deque>
13#include <map>
14
pbos@webrtc.org69215d82013-07-10 15:02:02 +000015#include "testing/gtest/include/gtest/gtest.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000016
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +000017#include "webrtc/base/scoped_ptr.h"
pbos@webrtc.org38344ed2014-09-24 06:05:00 +000018#include "webrtc/base/thread_annotations.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000019#include "webrtc/call.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000020#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
Erik Språng085856c2015-07-22 17:17:58 +020021#include "webrtc/frame_callback.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000022#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
23#include "webrtc/system_wrappers/interface/clock.h"
sprang@webrtc.org131bea82015-02-18 12:46:06 +000024#include "webrtc/system_wrappers/interface/cpu_info.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000025#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
26#include "webrtc/system_wrappers/interface/event_wrapper.h"
pbos@webrtc.org94015242013-10-16 11:05:37 +000027#include "webrtc/system_wrappers/interface/sleep.h"
pbos@webrtc.org994d0b72014-06-27 08:47:52 +000028#include "webrtc/test/call_test.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000029#include "webrtc/test/direct_transport.h"
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +000030#include "webrtc/test/encoder_settings.h"
31#include "webrtc/test/fake_encoder.h"
sprang@webrtc.org131bea82015-02-18 12:46:06 +000032#include "webrtc/test/frame_generator.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000033#include "webrtc/test/frame_generator_capturer.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000034#include "webrtc/test/statistics.h"
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +000035#include "webrtc/test/testsupport/fileutils.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000036#include "webrtc/typedefs.h"
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000037
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000038namespace webrtc {
39
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +000040static const int kFullStackTestDurationSecs = 60;
Erik Språng085856c2015-07-22 17:17:58 +020041static const int kSendStatsPollingIntervalMs = 1000;
pbos@webrtc.orgb613b5a2013-12-03 10:13:04 +000042
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000043struct FullStackTestParams {
44 const char* test_label;
45 struct {
46 const char* name;
pbos@webrtc.orgf3f13582013-07-09 14:04:46 +000047 size_t width, height;
48 int fps;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000049 } clip;
sprang@webrtc.org131bea82015-02-18 12:46:06 +000050 bool screenshare;
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +000051 int min_bitrate_bps;
52 int target_bitrate_bps;
53 int max_bitrate_bps;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000054 double avg_psnr_threshold;
55 double avg_ssim_threshold;
sprang@webrtc.org131bea82015-02-18 12:46:06 +000056 int test_durations_secs;
ivica028cf482015-07-30 02:15:56 -070057 std::string codec;
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +000058 FakeNetworkPipe::Config link;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000059};
60
pbos@webrtc.org994d0b72014-06-27 08:47:52 +000061class FullStackTest : public test::CallTest {
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000062 protected:
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +000063 void RunTest(const FullStackTestParams& params);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000064};
65
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000066class VideoAnalyzer : public PacketReceiver,
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000067 public newapi::Transport,
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000068 public VideoRenderer,
Erik Språng085856c2015-07-22 17:17:58 +020069 public VideoCaptureInput,
70 public EncodedFrameObserver {
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000071 public:
Peter Boström4b91bd02015-06-26 06:58:16 +020072 VideoAnalyzer(VideoCaptureInput* input,
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000073 Transport* transport,
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000074 const char* test_label,
75 double avg_psnr_threshold,
76 double avg_ssim_threshold,
pbos@webrtc.org94015242013-10-16 11:05:37 +000077 int duration_frames)
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000078 : input_(input),
79 transport_(transport),
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +000080 receiver_(nullptr),
Erik Språng085856c2015-07-22 17:17:58 +020081 send_stream_(nullptr),
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000082 test_label_(test_label),
sprang@webrtc.org131bea82015-02-18 12:46:06 +000083 frames_to_process_(duration_frames),
84 frames_recorded_(0),
85 frames_processed_(0),
pbos@webrtc.org94015242013-10-16 11:05:37 +000086 dropped_frames_(0),
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000087 last_render_time_(0),
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +000088 rtp_timestamp_delta_(0),
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000089 avg_psnr_threshold_(avg_psnr_threshold),
90 avg_ssim_threshold_(avg_ssim_threshold),
sprang@webrtc.org131bea82015-02-18 12:46:06 +000091 comparison_available_event_(EventWrapper::Create()),
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +000092 done_(EventWrapper::Create()) {
sprang@webrtc.org131bea82015-02-18 12:46:06 +000093 // Create thread pool for CPU-expensive PSNR/SSIM calculations.
94
95 // Try to use about as many threads as cores, but leave kMinCoresLeft alone,
96 // so that we don't accidentally starve "real" worker threads (codec etc).
97 // Also, don't allocate more than kMaxComparisonThreads, even if there are
98 // spare cores.
99
100 uint32_t num_cores = CpuInfo::DetectNumberOfCores();
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +0000101 DCHECK_GE(num_cores, 1u);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000102 static const uint32_t kMinCoresLeft = 4;
sprang@webrtc.org343096a2015-02-23 08:34:17 +0000103 static const uint32_t kMaxComparisonThreads = 8;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000104
105 if (num_cores <= kMinCoresLeft) {
106 num_cores = 1;
107 } else {
108 num_cores -= kMinCoresLeft;
109 num_cores = std::min(num_cores, kMaxComparisonThreads);
110 }
111
112 for (uint32_t i = 0; i < num_cores; ++i) {
tommi@webrtc.org361981f2015-03-19 14:44:18 +0000113 rtc::scoped_ptr<ThreadWrapper> thread =
tommi@webrtc.org38492c52015-03-22 14:41:46 +0000114 ThreadWrapper::CreateThread(&FrameComparisonThread, this, "Analyzer");
pbos@webrtc.org86639732015-03-13 00:06:21 +0000115 EXPECT_TRUE(thread->Start());
tommi@webrtc.org361981f2015-03-19 14:44:18 +0000116 comparison_thread_pool_.push_back(thread.release());
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000117 }
Erik Språng085856c2015-07-22 17:17:58 +0200118
119 stats_polling_thread_ =
120 ThreadWrapper::CreateThread(&PollStatsThread, this, "StatsPoller");
121 EXPECT_TRUE(stats_polling_thread_->Start());
pbos@webrtc.org94015242013-10-16 11:05:37 +0000122 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000123
124 ~VideoAnalyzer() {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000125 for (ThreadWrapper* thread : comparison_thread_pool_) {
126 EXPECT_TRUE(thread->Stop());
127 delete thread;
128 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000129 }
130
pbos@webrtc.org94015242013-10-16 11:05:37 +0000131 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; }
132
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +0200133 DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet,
134 size_t length) override {
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000135 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000136 RTPHeader header;
pbos@webrtc.org62bafae2014-07-08 12:10:51 +0000137 parser->Parse(packet, length, &header);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000138 {
Peter Boströmf2f82832015-05-01 13:00:41 +0200139 rtc::CritScope lock(&crit_);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000140 recv_times_[header.timestamp - rtp_timestamp_delta_] =
141 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds();
142 }
143
Fredrik Solenberg23fba1f2015-04-29 15:24:01 +0200144 return receiver_->DeliverPacket(media_type, packet, length);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000145 }
146
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700147 void IncomingCapturedFrame(const VideoFrame& video_frame) override {
148 VideoFrame copy = video_frame;
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000149 copy.set_timestamp(copy.ntp_time_ms() * 90);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000150
151 {
Peter Boströmf2f82832015-05-01 13:00:41 +0200152 rtc::CritScope lock(&crit_);
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000153 if (first_send_frame_.IsZeroSize() && rtp_timestamp_delta_ == 0)
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000154 first_send_frame_ = copy;
155
156 frames_.push_back(copy);
157 }
158
perkj@webrtc.orgaf612d52015-03-18 09:51:05 +0000159 input_->IncomingCapturedFrame(video_frame);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000160 }
161
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000162 bool SendRtp(const uint8_t* packet, size_t length) override {
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000163 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000164 RTPHeader header;
pbos@webrtc.org62bafae2014-07-08 12:10:51 +0000165 parser->Parse(packet, length, &header);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000166
167 {
Peter Boströmf2f82832015-05-01 13:00:41 +0200168 rtc::CritScope lock(&crit_);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000169 if (rtp_timestamp_delta_ == 0) {
170 rtp_timestamp_delta_ =
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000171 header.timestamp - first_send_frame_.timestamp();
172 first_send_frame_.Reset();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000173 }
pbos@webrtc.org7fb9ce02013-08-05 09:29:50 +0000174 send_times_[header.timestamp - rtp_timestamp_delta_] =
175 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000176 }
177
pbos@webrtc.org27326b62013-11-20 12:17:04 +0000178 return transport_->SendRtp(packet, length);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000179 }
180
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000181 bool SendRtcp(const uint8_t* packet, size_t length) override {
pbos@webrtc.org27326b62013-11-20 12:17:04 +0000182 return transport_->SendRtcp(packet, length);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000183 }
184
Erik Språng085856c2015-07-22 17:17:58 +0200185 void EncodedFrameCallback(const EncodedFrame& frame) override {
186 rtc::CritScope lock(&comparison_lock_);
187 if (frames_recorded_ < frames_to_process_)
188 encoded_frame_size_.AddSample(frame.length_);
189 }
190
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700191 void RenderFrame(const VideoFrame& video_frame,
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000192 int time_to_render_ms) override {
pbos@webrtc.org94015242013-10-16 11:05:37 +0000193 int64_t render_time_ms =
194 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000195 uint32_t send_timestamp = video_frame.timestamp() - rtp_timestamp_delta_;
196
Peter Boströmf2f82832015-05-01 13:00:41 +0200197 rtc::CritScope lock(&crit_);
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000198
199 while (frames_.front().timestamp() < send_timestamp) {
200 AddFrameComparison(frames_.front(), last_rendered_frame_, true,
201 render_time_ms);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000202 frames_.pop_front();
pbos@webrtc.org94015242013-10-16 11:05:37 +0000203 }
204
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700205 VideoFrame reference_frame = frames_.front();
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000206 frames_.pop_front();
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000207 assert(!reference_frame.IsZeroSize());
208 EXPECT_EQ(reference_frame.timestamp(), send_timestamp);
209 assert(reference_frame.timestamp() == send_timestamp);
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000210
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000211 AddFrameComparison(reference_frame, video_frame, false, render_time_ms);
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000212
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000213 last_rendered_frame_ = video_frame;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000214 }
215
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000216 bool IsTextureSupported() const override { return false; }
pbos@webrtc.org0d852d52015-02-09 15:14:36 +0000217
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000218 void Wait() {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000219 // Frame comparisons can be very expensive. Wait for test to be done, but
220 // at time-out check if frames_processed is going up. If so, give it more
221 // time, otherwise fail. Hopefully this will reduce test flakiness.
222
223 int last_frames_processed = -1;
224 EventTypeWrapper eventType;
Erik Språng2c274302015-08-31 17:21:14 +0200225 int iteration = 0;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000226 while ((eventType = done_->Wait(FullStackTest::kDefaultTimeoutMs)) !=
227 kEventSignaled) {
228 int frames_processed;
229 {
Peter Boströmf2f82832015-05-01 13:00:41 +0200230 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000231 frames_processed = frames_processed_;
232 }
Erik Språng2c274302015-08-31 17:21:14 +0200233
234 // Print some output so test infrastructure won't think we've crashed.
235 const char* kKeepAliveMessages[3] = {
236 "Uh, I'm-I'm not quite dead, sir.",
237 "Uh, I-I think uh, I could pull through, sir.",
238 "Actually, I think I'm all right to come with you--"};
239 printf("- %s\n", kKeepAliveMessages[iteration++ % 3]);
240
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000241 if (last_frames_processed == -1) {
242 last_frames_processed = frames_processed;
243 continue;
244 }
245 ASSERT_GT(frames_processed, last_frames_processed)
246 << "Analyzer stalled while waiting for test to finish.";
247 last_frames_processed = frames_processed;
248 }
Erik Språng085856c2015-07-22 17:17:58 +0200249
Erik Språng2c274302015-08-31 17:21:14 +0200250 if (iteration > 0)
251 printf("- Farewell, sweet Concorde!\n");
252
Erik Språng085856c2015-07-22 17:17:58 +0200253 // Signal stats polling thread if that is still waiting and stop it now,
254 // since it uses the send_stream_ reference that might be reclaimed after
255 // returning from this method.
256 done_->Set();
257 EXPECT_TRUE(stats_polling_thread_->Stop());
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000258 }
pbos@webrtc.org94015242013-10-16 11:05:37 +0000259
Peter Boström4b91bd02015-06-26 06:58:16 +0200260 VideoCaptureInput* input_;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000261 Transport* transport_;
262 PacketReceiver* receiver_;
Erik Språng085856c2015-07-22 17:17:58 +0200263 VideoSendStream* send_stream_;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000264
265 private:
266 struct FrameComparison {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000267 FrameComparison()
268 : dropped(false), send_time_ms(0), recv_time_ms(0), render_time_ms(0) {}
269
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700270 FrameComparison(const VideoFrame& reference,
271 const VideoFrame& render,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000272 bool dropped,
273 int64_t send_time_ms,
274 int64_t recv_time_ms,
275 int64_t render_time_ms)
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000276 : reference(reference),
277 render(render),
278 dropped(dropped),
pbos@webrtc.org94015242013-10-16 11:05:37 +0000279 send_time_ms(send_time_ms),
280 recv_time_ms(recv_time_ms),
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000281 render_time_ms(render_time_ms) {}
pbos@webrtc.org94015242013-10-16 11:05:37 +0000282
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700283 VideoFrame reference;
284 VideoFrame render;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000285 bool dropped;
286 int64_t send_time_ms;
287 int64_t recv_time_ms;
288 int64_t render_time_ms;
289 };
290
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700291 void AddFrameComparison(const VideoFrame& reference,
292 const VideoFrame& render,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000293 bool dropped,
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000294 int64_t render_time_ms)
295 EXCLUSIVE_LOCKS_REQUIRED(crit_) {
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000296 int64_t send_time_ms = send_times_[reference.timestamp()];
297 send_times_.erase(reference.timestamp());
298 int64_t recv_time_ms = recv_times_[reference.timestamp()];
299 recv_times_.erase(reference.timestamp());
pbos@webrtc.org94015242013-10-16 11:05:37 +0000300
Peter Boströmf2f82832015-05-01 13:00:41 +0200301 rtc::CritScope crit(&comparison_lock_);
Erik Språng085856c2015-07-22 17:17:58 +0200302 comparisons_.push_back(FrameComparison(reference, render, dropped,
303 send_time_ms, recv_time_ms,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000304 render_time_ms));
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000305 comparison_available_event_->Set();
pbos@webrtc.org94015242013-10-16 11:05:37 +0000306 }
307
Erik Språng085856c2015-07-22 17:17:58 +0200308 static bool PollStatsThread(void* obj) {
309 return static_cast<VideoAnalyzer*>(obj)->PollStats();
310 }
311
312 bool PollStats() {
313 switch (done_->Wait(kSendStatsPollingIntervalMs)) {
314 case kEventSignaled:
315 case kEventError:
316 done_->Set(); // Make sure main thread is also signaled.
317 return false;
318 case kEventTimeout:
319 break;
320 default:
321 RTC_NOTREACHED();
322 }
323
324 VideoSendStream::Stats stats = send_stream_->GetStats();
325
326 rtc::CritScope crit(&comparison_lock_);
327 encode_frame_rate_.AddSample(stats.encode_frame_rate);
328 encode_time_ms.AddSample(stats.avg_encode_time_ms);
329 encode_usage_percent.AddSample(stats.encode_usage_percent);
330 media_bitrate_bps.AddSample(stats.media_bitrate_bps);
331
332 return true;
333 }
334
pbos@webrtc.org94015242013-10-16 11:05:37 +0000335 static bool FrameComparisonThread(void* obj) {
336 return static_cast<VideoAnalyzer*>(obj)->CompareFrames();
337 }
338
339 bool CompareFrames() {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000340 if (AllFramesRecorded())
341 return false;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000342
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700343 VideoFrame reference;
344 VideoFrame render;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000345 FrameComparison comparison;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000346
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000347 if (!PopComparison(&comparison)) {
348 // Wait until new comparison task is available, or test is done.
349 // If done, wake up remaining threads waiting.
350 comparison_available_event_->Wait(1000);
351 if (AllFramesRecorded()) {
352 comparison_available_event_->Set();
pbos@webrtc.org94015242013-10-16 11:05:37 +0000353 return false;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000354 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000355 return true; // Try again.
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000356 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000357
358 PerformFrameComparison(comparison);
359
360 if (FrameProcessed()) {
361 PrintResults();
362 done_->Set();
363 comparison_available_event_->Set();
364 return false;
365 }
366
367 return true;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000368 }
369
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000370 bool PopComparison(FrameComparison* comparison) {
Peter Boströmf2f82832015-05-01 13:00:41 +0200371 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000372 // If AllFramesRecorded() is true, it means we have already popped
373 // frames_to_process_ frames from comparisons_, so there is no more work
374 // for this thread to be done. frames_processed_ might still be lower if
375 // all comparisons are not done, but those frames are currently being
376 // worked on by other threads.
377 if (comparisons_.empty() || AllFramesRecorded())
378 return false;
379
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000380 *comparison = comparisons_.front();
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000381 comparisons_.pop_front();
382
383 FrameRecorded();
384 return true;
385 }
386
387 // Increment counter for number of frames received for comparison.
388 void FrameRecorded() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200389 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000390 ++frames_recorded_;
391 }
392
393 // Returns true if all frames to be compared have been taken from the queue.
394 bool AllFramesRecorded() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200395 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000396 assert(frames_recorded_ <= frames_to_process_);
397 return frames_recorded_ == frames_to_process_;
398 }
399
400 // Increase count of number of frames processed. Returns true if this was the
401 // last frame to be processed.
402 bool FrameProcessed() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200403 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000404 ++frames_processed_;
405 assert(frames_processed_ <= frames_to_process_);
406 return frames_processed_ == frames_to_process_;
407 }
408
409 void PrintResults() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200410 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000411 PrintResult("psnr", psnr_, " dB");
412 PrintResult("ssim", ssim_, "");
413 PrintResult("sender_time", sender_time_, " ms");
414 printf("RESULT dropped_frames: %s = %d frames\n", test_label_,
415 dropped_frames_);
416 PrintResult("receiver_time", receiver_time_, " ms");
417 PrintResult("total_delay_incl_network", end_to_end_, " ms");
418 PrintResult("time_between_rendered_frames", rendered_delta_, " ms");
Erik Språng085856c2015-07-22 17:17:58 +0200419 PrintResult("encoded_frame_size", encoded_frame_size_, " bytes");
420 PrintResult("encode_frame_rate", encode_frame_rate_, " fps");
421 PrintResult("encode_time", encode_time_ms, " ms");
422 PrintResult("encode_usage_percent", encode_usage_percent, " percent");
423 PrintResult("media_bitrate", media_bitrate_bps, " bps");
424
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000425 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
426 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
427 }
428
429 void PerformFrameComparison(const FrameComparison& comparison) {
430 // Perform expensive psnr and ssim calculations while not holding lock.
magjed@webrtc.org2056ee32015-03-16 13:46:52 +0000431 double psnr = I420PSNR(&comparison.reference, &comparison.render);
432 double ssim = I420SSIM(&comparison.reference, &comparison.render);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000433
Peter Boströmf2f82832015-05-01 13:00:41 +0200434 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000435 psnr_.AddSample(psnr);
436 ssim_.AddSample(ssim);
437 if (comparison.dropped) {
pbos@webrtc.org94015242013-10-16 11:05:37 +0000438 ++dropped_frames_;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000439 return;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000440 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000441 if (last_render_time_ != 0)
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000442 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_);
443 last_render_time_ = comparison.render_time_ms;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000444
perkj@webrtc.orgaf612d52015-03-18 09:51:05 +0000445 int64_t input_time_ms = comparison.reference.ntp_time_ms();
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000446 sender_time_.AddSample(comparison.send_time_ms - input_time_ms);
447 receiver_time_.AddSample(comparison.render_time_ms -
448 comparison.recv_time_ms);
449 end_to_end_.AddSample(comparison.render_time_ms - input_time_ms);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000450 }
451
452 void PrintResult(const char* result_type,
453 test::Statistics stats,
454 const char* unit) {
455 printf("RESULT %s: %s = {%f, %f}%s\n",
456 result_type,
457 test_label_,
458 stats.Mean(),
459 stats.StandardDeviation(),
460 unit);
461 }
462
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000463 const char* const test_label_;
Erik Språng085856c2015-07-22 17:17:58 +0200464 test::Statistics sender_time_ GUARDED_BY(comparison_lock_);
465 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_);
466 test::Statistics psnr_ GUARDED_BY(comparison_lock_);
467 test::Statistics ssim_ GUARDED_BY(comparison_lock_);
468 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_);
469 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_);
470 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_);
471 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_);
472 test::Statistics encode_time_ms GUARDED_BY(comparison_lock_);
473 test::Statistics encode_usage_percent GUARDED_BY(comparison_lock_);
474 test::Statistics media_bitrate_bps GUARDED_BY(comparison_lock_);
475
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000476 const int frames_to_process_;
477 int frames_recorded_;
478 int frames_processed_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000479 int dropped_frames_;
480 int64_t last_render_time_;
481 uint32_t rtp_timestamp_delta_;
482
Peter Boströmf2f82832015-05-01 13:00:41 +0200483 rtc::CriticalSection crit_;
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700484 std::deque<VideoFrame> frames_ GUARDED_BY(crit_);
485 VideoFrame last_rendered_frame_ GUARDED_BY(crit_);
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000486 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_);
487 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_);
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700488 VideoFrame first_send_frame_ GUARDED_BY(crit_);
pbos@webrtc.orgb35b1362014-10-20 09:14:38 +0000489 const double avg_psnr_threshold_;
490 const double avg_ssim_threshold_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000491
Peter Boströmf2f82832015-05-01 13:00:41 +0200492 rtc::CriticalSection comparison_lock_;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000493 std::vector<ThreadWrapper*> comparison_thread_pool_;
Erik Språng085856c2015-07-22 17:17:58 +0200494 rtc::scoped_ptr<ThreadWrapper> stats_polling_thread_;
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000495 const rtc::scoped_ptr<EventWrapper> comparison_available_event_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000496 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000497 const rtc::scoped_ptr<EventWrapper> done_;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000498};
499
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000500void FullStackTest::RunTest(const FullStackTestParams& params) {
501 test::DirectTransport send_transport(params.link);
502 test::DirectTransport recv_transport(params.link);
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +0000503 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000504 params.avg_psnr_threshold, params.avg_ssim_threshold,
505 params.test_durations_secs * params.clip.fps);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000506
solenberg4fbae2b2015-08-28 04:07:10 -0700507 CreateCalls(Call::Config(), Call::Config());
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +0000508
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000509 analyzer.SetReceiver(receiver_call_->Receiver());
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000510 send_transport.SetReceiver(&analyzer);
511 recv_transport.SetReceiver(sender_call_->Receiver());
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000512
solenberg4fbae2b2015-08-28 04:07:10 -0700513 CreateSendConfig(1, &analyzer);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000514
ivica028cf482015-07-30 02:15:56 -0700515 rtc::scoped_ptr<VideoEncoder> encoder;
516 if (params.codec == "VP8") {
517 encoder =
518 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp8));
519 send_config_.encoder_settings.encoder = encoder.get();
520 send_config_.encoder_settings.payload_name = "VP8";
521 } else if (params.codec == "VP9") {
522 encoder =
523 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp9));
524 send_config_.encoder_settings.encoder = encoder.get();
525 send_config_.encoder_settings.payload_name = "VP9";
526 } else {
527 RTC_NOTREACHED() << "Codec not supported!";
528 return;
529 }
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000530 send_config_.encoder_settings.payload_type = 124;
ivica028cf482015-07-30 02:15:56 -0700531
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000532 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000533 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
534 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000535
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000536 VideoStream* stream = &encoder_config_.streams[0];
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000537 stream->width = params.clip.width;
538 stream->height = params.clip.height;
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000539 stream->min_bitrate_bps = params.min_bitrate_bps;
540 stream->target_bitrate_bps = params.target_bitrate_bps;
541 stream->max_bitrate_bps = params.max_bitrate_bps;
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000542 stream->max_framerate = params.clip.fps;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000543
ivica028cf482015-07-30 02:15:56 -0700544 VideoCodecVP8 vp8_settings;
545 VideoCodecVP9 vp9_settings;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000546 if (params.screenshare) {
Erik Språng143cec12015-04-28 10:01:41 +0200547 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000548 encoder_config_.min_transmit_bitrate_bps = 400 * 1000;
ivica028cf482015-07-30 02:15:56 -0700549 if (params.codec == "VP8") {
550 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
551 vp8_settings.denoisingOn = false;
552 vp8_settings.frameDroppingOn = false;
553 vp8_settings.numberOfTemporalLayers = 2;
554 encoder_config_.encoder_specific_settings = &vp8_settings;
555 } else if (params.codec == "VP9") {
556 vp9_settings = VideoEncoder::GetDefaultVp9Settings();
557 vp9_settings.denoisingOn = false;
558 vp9_settings.frameDroppingOn = false;
559 vp9_settings.numberOfTemporalLayers = 2;
560 encoder_config_.encoder_specific_settings = &vp9_settings;
561 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000562
563 stream->temporal_layer_thresholds_bps.clear();
564 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps);
565 }
566
solenberg4fbae2b2015-08-28 04:07:10 -0700567 CreateMatchingReceiveConfigs(&recv_transport);
pbos@webrtc.orgbe9d2a42014-06-30 13:19:09 +0000568 receive_configs_[0].renderer = &analyzer;
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000569 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000570 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0];
571 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type =
sprang@webrtc.org343096a2015-02-23 08:34:17 +0000572 kSendRtxPayloadType;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000573
Erik Språng085856c2015-07-22 17:17:58 +0200574 for (auto& config : receive_configs_)
575 config.pre_decode_callback = &analyzer;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000576 CreateStreams();
577 analyzer.input_ = send_stream_->Input();
Erik Språng085856c2015-07-22 17:17:58 +0200578 analyzer.send_stream_ = send_stream_;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000579
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000580 if (params.screenshare) {
581 std::vector<std::string> slides;
582 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv"));
583 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv"));
584 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv"));
585 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv"));
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000586
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000587 rtc::scoped_ptr<test::FrameGenerator> frame_generator(
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000588 test::FrameGenerator::CreateFromYuvFile(
589 slides, 1850, 1110,
590 10 * params.clip.fps) // Cycle image every 10 seconds.
591 );
592 frame_generator_capturer_.reset(new test::FrameGeneratorCapturer(
593 Clock::GetRealTimeClock(), &analyzer, frame_generator.release(),
594 params.clip.fps));
595 ASSERT_TRUE(frame_generator_capturer_->Init());
596 } else {
597 frame_generator_capturer_.reset(
598 test::FrameGeneratorCapturer::CreateFromYuvFile(
599 &analyzer, test::ResourcePath(params.clip.name, "yuv"),
600 params.clip.width, params.clip.height, params.clip.fps,
601 Clock::GetRealTimeClock()));
602
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +0000603 ASSERT_TRUE(frame_generator_capturer_.get() != nullptr)
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000604 << "Could not create capturer for " << params.clip.name
605 << ".yuv. Is this resource file present?";
606 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000607
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000608 Start();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000609
610 analyzer.Wait();
611
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000612 send_transport.StopSending();
613 recv_transport.StopSending();
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000614
615 Stop();
616
617 DestroyStreams();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000618}
619
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000620TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) {
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000621 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0",
622 {"paris_qcif", 176, 144, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000623 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000624 300000,
625 300000,
626 300000,
627 36.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000628 0.96,
ivica028cf482015-07-30 02:15:56 -0700629 kFullStackTestDurationSecs,
630 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000631 RunTest(paris_qcif);
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000632}
633
634TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) {
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000635 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif.
636 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0",
637 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000638 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000639 700000,
640 700000,
641 700000,
642 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000643 0.0,
ivica028cf482015-07-30 02:15:56 -0700644 kFullStackTestDurationSecs,
645 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000646 RunTest(foreman_cif);
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000647}
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000648
sprang@webrtc.org343096a2015-02-23 08:34:17 +0000649TEST_F(FullStackTest, ForemanCifPlr5) {
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000650 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5",
651 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000652 false,
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000653 30000,
654 500000,
655 2000000,
656 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000657 0.0,
ivica028cf482015-07-30 02:15:56 -0700658 kFullStackTestDurationSecs,
659 "VP8"};
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000660 foreman_cif.link.loss_percent = 5;
661 foreman_cif.link.queue_delay_ms = 50;
662 RunTest(foreman_cif);
663}
664
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000665TEST_F(FullStackTest, ForemanCif500kbps) {
666 FullStackTestParams foreman_cif = {"foreman_cif_500kbps",
667 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000668 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000669 30000,
670 500000,
671 2000000,
672 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000673 0.0,
ivica028cf482015-07-30 02:15:56 -0700674 kFullStackTestDurationSecs,
675 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000676 foreman_cif.link.queue_length_packets = 0;
677 foreman_cif.link.queue_delay_ms = 0;
678 foreman_cif.link.link_capacity_kbps = 500;
679 RunTest(foreman_cif);
680}
681
682TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) {
683 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue",
684 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000685 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000686 30000,
687 500000,
688 2000000,
689 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000690 0.0,
ivica028cf482015-07-30 02:15:56 -0700691 kFullStackTestDurationSecs,
692 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000693 foreman_cif.link.queue_length_packets = 32;
694 foreman_cif.link.queue_delay_ms = 0;
695 foreman_cif.link.link_capacity_kbps = 500;
696 RunTest(foreman_cif);
697}
698
699TEST_F(FullStackTest, ForemanCif500kbps100ms) {
700 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms",
701 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000702 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000703 30000,
704 500000,
705 2000000,
706 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000707 0.0,
ivica028cf482015-07-30 02:15:56 -0700708 kFullStackTestDurationSecs,
709 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000710 foreman_cif.link.queue_length_packets = 0;
711 foreman_cif.link.queue_delay_ms = 100;
712 foreman_cif.link.link_capacity_kbps = 500;
713 RunTest(foreman_cif);
714}
715
716TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) {
717 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue",
718 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000719 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000720 30000,
721 500000,
722 2000000,
723 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000724 0.0,
ivica028cf482015-07-30 02:15:56 -0700725 kFullStackTestDurationSecs,
726 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000727 foreman_cif.link.queue_length_packets = 32;
728 foreman_cif.link.queue_delay_ms = 100;
729 foreman_cif.link.link_capacity_kbps = 500;
730 RunTest(foreman_cif);
731}
732
733TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) {
734 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue",
735 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000736 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000737 30000,
738 2000000,
739 2000000,
740 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000741 0.0,
ivica028cf482015-07-30 02:15:56 -0700742 kFullStackTestDurationSecs,
743 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000744 foreman_cif.link.queue_length_packets = 32;
745 foreman_cif.link.queue_delay_ms = 100;
746 foreman_cif.link.link_capacity_kbps = 1000;
747 RunTest(foreman_cif);
748}
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000749
Peter Boströmb21fd942015-07-23 13:14:20 +0200750// Temporarily disabled on Android due to low test timeouts.
751// https://code.google.com/p/chromium/issues/detail?id=513170
752#include "webrtc/test/testsupport/gtest_disable.h"
ivica028cf482015-07-30 02:15:56 -0700753TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000754 FullStackTestParams screenshare_params = {
755 "screenshare_slides",
756 {"screenshare_slides", 1850, 1110, 5},
757 true,
758 50000,
Erik Språng2c4c9142015-06-24 11:24:44 +0200759 200000,
760 2000000,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000761 0.0,
762 0.0,
ivica028cf482015-07-30 02:15:56 -0700763 kFullStackTestDurationSecs,
764 "VP8"};
765 RunTest(screenshare_params);
766}
767
ivicad6b243f2015-08-11 10:43:02 -0700768// Disabled on Android along with VP8 screenshare above.
769TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP9_2TL)) {
ivica028cf482015-07-30 02:15:56 -0700770 FullStackTestParams screenshare_params = {
771 "screenshare_slides_vp9_2tl",
772 {"screenshare_slides", 1850, 1110, 5},
773 true,
774 50000,
775 200000,
776 2000000,
777 0.0,
778 0.0,
779 kFullStackTestDurationSecs,
780 "VP9"};
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000781 RunTest(screenshare_params);
782}
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000783} // namespace webrtc