blob: aac11ac4d4a07408d20a98fb7e9823b70d424749 [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;
225 while ((eventType = done_->Wait(FullStackTest::kDefaultTimeoutMs)) !=
226 kEventSignaled) {
227 int frames_processed;
228 {
Peter Boströmf2f82832015-05-01 13:00:41 +0200229 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000230 frames_processed = frames_processed_;
231 }
232 if (last_frames_processed == -1) {
233 last_frames_processed = frames_processed;
234 continue;
235 }
236 ASSERT_GT(frames_processed, last_frames_processed)
237 << "Analyzer stalled while waiting for test to finish.";
238 last_frames_processed = frames_processed;
239 }
Erik Språng085856c2015-07-22 17:17:58 +0200240
241 // Signal stats polling thread if that is still waiting and stop it now,
242 // since it uses the send_stream_ reference that might be reclaimed after
243 // returning from this method.
244 done_->Set();
245 EXPECT_TRUE(stats_polling_thread_->Stop());
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000246 }
pbos@webrtc.org94015242013-10-16 11:05:37 +0000247
Peter Boström4b91bd02015-06-26 06:58:16 +0200248 VideoCaptureInput* input_;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000249 Transport* transport_;
250 PacketReceiver* receiver_;
Erik Språng085856c2015-07-22 17:17:58 +0200251 VideoSendStream* send_stream_;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000252
253 private:
254 struct FrameComparison {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000255 FrameComparison()
256 : dropped(false), send_time_ms(0), recv_time_ms(0), render_time_ms(0) {}
257
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700258 FrameComparison(const VideoFrame& reference,
259 const VideoFrame& render,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000260 bool dropped,
261 int64_t send_time_ms,
262 int64_t recv_time_ms,
263 int64_t render_time_ms)
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000264 : reference(reference),
265 render(render),
266 dropped(dropped),
pbos@webrtc.org94015242013-10-16 11:05:37 +0000267 send_time_ms(send_time_ms),
268 recv_time_ms(recv_time_ms),
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000269 render_time_ms(render_time_ms) {}
pbos@webrtc.org94015242013-10-16 11:05:37 +0000270
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700271 VideoFrame reference;
272 VideoFrame render;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000273 bool dropped;
274 int64_t send_time_ms;
275 int64_t recv_time_ms;
276 int64_t render_time_ms;
277 };
278
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700279 void AddFrameComparison(const VideoFrame& reference,
280 const VideoFrame& render,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000281 bool dropped,
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000282 int64_t render_time_ms)
283 EXCLUSIVE_LOCKS_REQUIRED(crit_) {
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000284 int64_t send_time_ms = send_times_[reference.timestamp()];
285 send_times_.erase(reference.timestamp());
286 int64_t recv_time_ms = recv_times_[reference.timestamp()];
287 recv_times_.erase(reference.timestamp());
pbos@webrtc.org94015242013-10-16 11:05:37 +0000288
Peter Boströmf2f82832015-05-01 13:00:41 +0200289 rtc::CritScope crit(&comparison_lock_);
Erik Språng085856c2015-07-22 17:17:58 +0200290 comparisons_.push_back(FrameComparison(reference, render, dropped,
291 send_time_ms, recv_time_ms,
pbos@webrtc.org94015242013-10-16 11:05:37 +0000292 render_time_ms));
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000293 comparison_available_event_->Set();
pbos@webrtc.org94015242013-10-16 11:05:37 +0000294 }
295
Erik Språng085856c2015-07-22 17:17:58 +0200296 static bool PollStatsThread(void* obj) {
297 return static_cast<VideoAnalyzer*>(obj)->PollStats();
298 }
299
300 bool PollStats() {
301 switch (done_->Wait(kSendStatsPollingIntervalMs)) {
302 case kEventSignaled:
303 case kEventError:
304 done_->Set(); // Make sure main thread is also signaled.
305 return false;
306 case kEventTimeout:
307 break;
308 default:
309 RTC_NOTREACHED();
310 }
311
312 VideoSendStream::Stats stats = send_stream_->GetStats();
313
314 rtc::CritScope crit(&comparison_lock_);
315 encode_frame_rate_.AddSample(stats.encode_frame_rate);
316 encode_time_ms.AddSample(stats.avg_encode_time_ms);
317 encode_usage_percent.AddSample(stats.encode_usage_percent);
318 media_bitrate_bps.AddSample(stats.media_bitrate_bps);
319
320 return true;
321 }
322
pbos@webrtc.org94015242013-10-16 11:05:37 +0000323 static bool FrameComparisonThread(void* obj) {
324 return static_cast<VideoAnalyzer*>(obj)->CompareFrames();
325 }
326
327 bool CompareFrames() {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000328 if (AllFramesRecorded())
329 return false;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000330
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700331 VideoFrame reference;
332 VideoFrame render;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000333 FrameComparison comparison;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000334
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000335 if (!PopComparison(&comparison)) {
336 // Wait until new comparison task is available, or test is done.
337 // If done, wake up remaining threads waiting.
338 comparison_available_event_->Wait(1000);
339 if (AllFramesRecorded()) {
340 comparison_available_event_->Set();
pbos@webrtc.org94015242013-10-16 11:05:37 +0000341 return false;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000342 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000343 return true; // Try again.
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000344 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000345
346 PerformFrameComparison(comparison);
347
348 if (FrameProcessed()) {
349 PrintResults();
350 done_->Set();
351 comparison_available_event_->Set();
352 return false;
353 }
354
355 return true;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000356 }
357
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000358 bool PopComparison(FrameComparison* comparison) {
Peter Boströmf2f82832015-05-01 13:00:41 +0200359 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000360 // If AllFramesRecorded() is true, it means we have already popped
361 // frames_to_process_ frames from comparisons_, so there is no more work
362 // for this thread to be done. frames_processed_ might still be lower if
363 // all comparisons are not done, but those frames are currently being
364 // worked on by other threads.
365 if (comparisons_.empty() || AllFramesRecorded())
366 return false;
367
pbos@webrtc.org443ad402015-03-20 07:34:28 +0000368 *comparison = comparisons_.front();
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000369 comparisons_.pop_front();
370
371 FrameRecorded();
372 return true;
373 }
374
375 // Increment counter for number of frames received for comparison.
376 void FrameRecorded() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200377 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000378 ++frames_recorded_;
379 }
380
381 // Returns true if all frames to be compared have been taken from the queue.
382 bool AllFramesRecorded() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200383 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000384 assert(frames_recorded_ <= frames_to_process_);
385 return frames_recorded_ == frames_to_process_;
386 }
387
388 // Increase count of number of frames processed. Returns true if this was the
389 // last frame to be processed.
390 bool FrameProcessed() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200391 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000392 ++frames_processed_;
393 assert(frames_processed_ <= frames_to_process_);
394 return frames_processed_ == frames_to_process_;
395 }
396
397 void PrintResults() {
Peter Boströmf2f82832015-05-01 13:00:41 +0200398 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000399 PrintResult("psnr", psnr_, " dB");
400 PrintResult("ssim", ssim_, "");
401 PrintResult("sender_time", sender_time_, " ms");
402 printf("RESULT dropped_frames: %s = %d frames\n", test_label_,
403 dropped_frames_);
404 PrintResult("receiver_time", receiver_time_, " ms");
405 PrintResult("total_delay_incl_network", end_to_end_, " ms");
406 PrintResult("time_between_rendered_frames", rendered_delta_, " ms");
Erik Språng085856c2015-07-22 17:17:58 +0200407 PrintResult("encoded_frame_size", encoded_frame_size_, " bytes");
408 PrintResult("encode_frame_rate", encode_frame_rate_, " fps");
409 PrintResult("encode_time", encode_time_ms, " ms");
410 PrintResult("encode_usage_percent", encode_usage_percent, " percent");
411 PrintResult("media_bitrate", media_bitrate_bps, " bps");
412
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000413 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_);
414 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_);
415 }
416
417 void PerformFrameComparison(const FrameComparison& comparison) {
418 // Perform expensive psnr and ssim calculations while not holding lock.
magjed@webrtc.org2056ee32015-03-16 13:46:52 +0000419 double psnr = I420PSNR(&comparison.reference, &comparison.render);
420 double ssim = I420SSIM(&comparison.reference, &comparison.render);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000421
Peter Boströmf2f82832015-05-01 13:00:41 +0200422 rtc::CritScope crit(&comparison_lock_);
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000423 psnr_.AddSample(psnr);
424 ssim_.AddSample(ssim);
425 if (comparison.dropped) {
pbos@webrtc.org94015242013-10-16 11:05:37 +0000426 ++dropped_frames_;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000427 return;
pbos@webrtc.org94015242013-10-16 11:05:37 +0000428 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000429 if (last_render_time_ != 0)
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000430 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_);
431 last_render_time_ = comparison.render_time_ms;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000432
perkj@webrtc.orgaf612d52015-03-18 09:51:05 +0000433 int64_t input_time_ms = comparison.reference.ntp_time_ms();
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000434 sender_time_.AddSample(comparison.send_time_ms - input_time_ms);
435 receiver_time_.AddSample(comparison.render_time_ms -
436 comparison.recv_time_ms);
437 end_to_end_.AddSample(comparison.render_time_ms - input_time_ms);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000438 }
439
440 void PrintResult(const char* result_type,
441 test::Statistics stats,
442 const char* unit) {
443 printf("RESULT %s: %s = {%f, %f}%s\n",
444 result_type,
445 test_label_,
446 stats.Mean(),
447 stats.StandardDeviation(),
448 unit);
449 }
450
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000451 const char* const test_label_;
Erik Språng085856c2015-07-22 17:17:58 +0200452 test::Statistics sender_time_ GUARDED_BY(comparison_lock_);
453 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_);
454 test::Statistics psnr_ GUARDED_BY(comparison_lock_);
455 test::Statistics ssim_ GUARDED_BY(comparison_lock_);
456 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_);
457 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_);
458 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_);
459 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_);
460 test::Statistics encode_time_ms GUARDED_BY(comparison_lock_);
461 test::Statistics encode_usage_percent GUARDED_BY(comparison_lock_);
462 test::Statistics media_bitrate_bps GUARDED_BY(comparison_lock_);
463
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000464 const int frames_to_process_;
465 int frames_recorded_;
466 int frames_processed_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000467 int dropped_frames_;
468 int64_t last_render_time_;
469 uint32_t rtp_timestamp_delta_;
470
Peter Boströmf2f82832015-05-01 13:00:41 +0200471 rtc::CriticalSection crit_;
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700472 std::deque<VideoFrame> frames_ GUARDED_BY(crit_);
473 VideoFrame last_rendered_frame_ GUARDED_BY(crit_);
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000474 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_);
475 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_);
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -0700476 VideoFrame first_send_frame_ GUARDED_BY(crit_);
pbos@webrtc.orgb35b1362014-10-20 09:14:38 +0000477 const double avg_psnr_threshold_;
478 const double avg_ssim_threshold_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000479
Peter Boströmf2f82832015-05-01 13:00:41 +0200480 rtc::CriticalSection comparison_lock_;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000481 std::vector<ThreadWrapper*> comparison_thread_pool_;
Erik Språng085856c2015-07-22 17:17:58 +0200482 rtc::scoped_ptr<ThreadWrapper> stats_polling_thread_;
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000483 const rtc::scoped_ptr<EventWrapper> comparison_available_event_;
pbos@webrtc.orgde1429e2014-04-28 13:00:21 +0000484 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000485 const rtc::scoped_ptr<EventWrapper> done_;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000486};
487
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000488void FullStackTest::RunTest(const FullStackTestParams& params) {
489 test::DirectTransport send_transport(params.link);
490 test::DirectTransport recv_transport(params.link);
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +0000491 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000492 params.avg_psnr_threshold, params.avg_ssim_threshold,
493 params.test_durations_secs * params.clip.fps);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000494
solenberg4fbae2b2015-08-28 04:07:10 -0700495 CreateCalls(Call::Config(), Call::Config());
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +0000496
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000497 analyzer.SetReceiver(receiver_call_->Receiver());
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000498 send_transport.SetReceiver(&analyzer);
499 recv_transport.SetReceiver(sender_call_->Receiver());
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000500
solenberg4fbae2b2015-08-28 04:07:10 -0700501 CreateSendConfig(1, &analyzer);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000502
ivica028cf482015-07-30 02:15:56 -0700503 rtc::scoped_ptr<VideoEncoder> encoder;
504 if (params.codec == "VP8") {
505 encoder =
506 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp8));
507 send_config_.encoder_settings.encoder = encoder.get();
508 send_config_.encoder_settings.payload_name = "VP8";
509 } else if (params.codec == "VP9") {
510 encoder =
511 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp9));
512 send_config_.encoder_settings.encoder = encoder.get();
513 send_config_.encoder_settings.payload_name = "VP9";
514 } else {
515 RTC_NOTREACHED() << "Codec not supported!";
516 return;
517 }
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000518 send_config_.encoder_settings.payload_type = 124;
ivica028cf482015-07-30 02:15:56 -0700519
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000520 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000521 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
522 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000523
pbos@webrtc.orgbbe0a852014-09-19 12:30:25 +0000524 VideoStream* stream = &encoder_config_.streams[0];
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000525 stream->width = params.clip.width;
526 stream->height = params.clip.height;
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000527 stream->min_bitrate_bps = params.min_bitrate_bps;
528 stream->target_bitrate_bps = params.target_bitrate_bps;
529 stream->max_bitrate_bps = params.max_bitrate_bps;
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +0000530 stream->max_framerate = params.clip.fps;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000531
ivica028cf482015-07-30 02:15:56 -0700532 VideoCodecVP8 vp8_settings;
533 VideoCodecVP9 vp9_settings;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000534 if (params.screenshare) {
Erik Språng143cec12015-04-28 10:01:41 +0200535 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000536 encoder_config_.min_transmit_bitrate_bps = 400 * 1000;
ivica028cf482015-07-30 02:15:56 -0700537 if (params.codec == "VP8") {
538 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
539 vp8_settings.denoisingOn = false;
540 vp8_settings.frameDroppingOn = false;
541 vp8_settings.numberOfTemporalLayers = 2;
542 encoder_config_.encoder_specific_settings = &vp8_settings;
543 } else if (params.codec == "VP9") {
544 vp9_settings = VideoEncoder::GetDefaultVp9Settings();
545 vp9_settings.denoisingOn = false;
546 vp9_settings.frameDroppingOn = false;
547 vp9_settings.numberOfTemporalLayers = 2;
548 encoder_config_.encoder_specific_settings = &vp9_settings;
549 }
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000550
551 stream->temporal_layer_thresholds_bps.clear();
552 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps);
553 }
554
solenberg4fbae2b2015-08-28 04:07:10 -0700555 CreateMatchingReceiveConfigs(&recv_transport);
pbos@webrtc.orgbe9d2a42014-06-30 13:19:09 +0000556 receive_configs_[0].renderer = &analyzer;
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000557 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000558 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0];
559 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type =
sprang@webrtc.org343096a2015-02-23 08:34:17 +0000560 kSendRtxPayloadType;
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000561
Erik Språng085856c2015-07-22 17:17:58 +0200562 for (auto& config : receive_configs_)
563 config.pre_decode_callback = &analyzer;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000564 CreateStreams();
565 analyzer.input_ = send_stream_->Input();
Erik Språng085856c2015-07-22 17:17:58 +0200566 analyzer.send_stream_ = send_stream_;
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000567
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000568 if (params.screenshare) {
569 std::vector<std::string> slides;
570 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv"));
571 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv"));
572 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv"));
573 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv"));
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000574
kwiberg@webrtc.org00b8f6b2015-02-26 14:34:55 +0000575 rtc::scoped_ptr<test::FrameGenerator> frame_generator(
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000576 test::FrameGenerator::CreateFromYuvFile(
577 slides, 1850, 1110,
578 10 * params.clip.fps) // Cycle image every 10 seconds.
579 );
580 frame_generator_capturer_.reset(new test::FrameGeneratorCapturer(
581 Clock::GetRealTimeClock(), &analyzer, frame_generator.release(),
582 params.clip.fps));
583 ASSERT_TRUE(frame_generator_capturer_->Init());
584 } else {
585 frame_generator_capturer_.reset(
586 test::FrameGeneratorCapturer::CreateFromYuvFile(
587 &analyzer, test::ResourcePath(params.clip.name, "yuv"),
588 params.clip.width, params.clip.height, params.clip.fps,
589 Clock::GetRealTimeClock()));
590
pbos@webrtc.org2b4ce3a2015-03-23 13:12:24 +0000591 ASSERT_TRUE(frame_generator_capturer_.get() != nullptr)
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000592 << "Could not create capturer for " << params.clip.name
593 << ".yuv. Is this resource file present?";
594 }
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000595
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000596 Start();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000597
598 analyzer.Wait();
599
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000600 send_transport.StopSending();
601 recv_transport.StopSending();
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000602
603 Stop();
604
605 DestroyStreams();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000606}
607
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000608TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) {
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000609 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0",
610 {"paris_qcif", 176, 144, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000611 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000612 300000,
613 300000,
614 300000,
615 36.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000616 0.96,
ivica028cf482015-07-30 02:15:56 -0700617 kFullStackTestDurationSecs,
618 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000619 RunTest(paris_qcif);
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000620}
621
622TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) {
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000623 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif.
624 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0",
625 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000626 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000627 700000,
628 700000,
629 700000,
630 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000631 0.0,
ivica028cf482015-07-30 02:15:56 -0700632 kFullStackTestDurationSecs,
633 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000634 RunTest(foreman_cif);
pbos@webrtc.org994d0b72014-06-27 08:47:52 +0000635}
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000636
sprang@webrtc.org343096a2015-02-23 08:34:17 +0000637TEST_F(FullStackTest, ForemanCifPlr5) {
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000638 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5",
639 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000640 false,
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000641 30000,
642 500000,
643 2000000,
644 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000645 0.0,
ivica028cf482015-07-30 02:15:56 -0700646 kFullStackTestDurationSecs,
647 "VP8"};
stefan@webrtc.orgc216b9a2014-10-14 10:38:49 +0000648 foreman_cif.link.loss_percent = 5;
649 foreman_cif.link.queue_delay_ms = 50;
650 RunTest(foreman_cif);
651}
652
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000653TEST_F(FullStackTest, ForemanCif500kbps) {
654 FullStackTestParams foreman_cif = {"foreman_cif_500kbps",
655 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000656 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000657 30000,
658 500000,
659 2000000,
660 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000661 0.0,
ivica028cf482015-07-30 02:15:56 -0700662 kFullStackTestDurationSecs,
663 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000664 foreman_cif.link.queue_length_packets = 0;
665 foreman_cif.link.queue_delay_ms = 0;
666 foreman_cif.link.link_capacity_kbps = 500;
667 RunTest(foreman_cif);
668}
669
670TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) {
671 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue",
672 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000673 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000674 30000,
675 500000,
676 2000000,
677 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000678 0.0,
ivica028cf482015-07-30 02:15:56 -0700679 kFullStackTestDurationSecs,
680 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000681 foreman_cif.link.queue_length_packets = 32;
682 foreman_cif.link.queue_delay_ms = 0;
683 foreman_cif.link.link_capacity_kbps = 500;
684 RunTest(foreman_cif);
685}
686
687TEST_F(FullStackTest, ForemanCif500kbps100ms) {
688 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms",
689 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000690 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000691 30000,
692 500000,
693 2000000,
694 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000695 0.0,
ivica028cf482015-07-30 02:15:56 -0700696 kFullStackTestDurationSecs,
697 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000698 foreman_cif.link.queue_length_packets = 0;
699 foreman_cif.link.queue_delay_ms = 100;
700 foreman_cif.link.link_capacity_kbps = 500;
701 RunTest(foreman_cif);
702}
703
704TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) {
705 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue",
706 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000707 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000708 30000,
709 500000,
710 2000000,
711 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000712 0.0,
ivica028cf482015-07-30 02:15:56 -0700713 kFullStackTestDurationSecs,
714 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000715 foreman_cif.link.queue_length_packets = 32;
716 foreman_cif.link.queue_delay_ms = 100;
717 foreman_cif.link.link_capacity_kbps = 500;
718 RunTest(foreman_cif);
719}
720
721TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) {
722 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue",
723 {"foreman_cif", 352, 288, 30},
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000724 false,
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000725 30000,
726 2000000,
727 2000000,
728 0.0,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000729 0.0,
ivica028cf482015-07-30 02:15:56 -0700730 kFullStackTestDurationSecs,
731 "VP8"};
stefan@webrtc.orgb8e9e442014-07-09 11:29:06 +0000732 foreman_cif.link.queue_length_packets = 32;
733 foreman_cif.link.queue_delay_ms = 100;
734 foreman_cif.link.link_capacity_kbps = 1000;
735 RunTest(foreman_cif);
736}
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000737
Peter Boströmb21fd942015-07-23 13:14:20 +0200738// Temporarily disabled on Android due to low test timeouts.
739// https://code.google.com/p/chromium/issues/detail?id=513170
740#include "webrtc/test/testsupport/gtest_disable.h"
ivica028cf482015-07-30 02:15:56 -0700741TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP8_2TL)) {
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000742 FullStackTestParams screenshare_params = {
743 "screenshare_slides",
744 {"screenshare_slides", 1850, 1110, 5},
745 true,
746 50000,
Erik Språng2c4c9142015-06-24 11:24:44 +0200747 200000,
748 2000000,
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000749 0.0,
750 0.0,
ivica028cf482015-07-30 02:15:56 -0700751 kFullStackTestDurationSecs,
752 "VP8"};
753 RunTest(screenshare_params);
754}
755
ivicad6b243f2015-08-11 10:43:02 -0700756// Disabled on Android along with VP8 screenshare above.
757TEST_F(FullStackTest, DISABLED_ON_ANDROID(ScreenshareSlidesVP9_2TL)) {
ivica028cf482015-07-30 02:15:56 -0700758 FullStackTestParams screenshare_params = {
759 "screenshare_slides_vp9_2tl",
760 {"screenshare_slides", 1850, 1110, 5},
761 true,
762 50000,
763 200000,
764 2000000,
765 0.0,
766 0.0,
767 kFullStackTestDurationSecs,
768 "VP9"};
sprang@webrtc.org131bea82015-02-18 12:46:06 +0000769 RunTest(screenshare_params);
770}
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +0000771} // namespace webrtc