OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <deque> | 12 #include <deque> |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
| 17 #include "webrtc/base/format_macros.h" |
17 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
19 #include "webrtc/call.h" | 20 #include "webrtc/call.h" |
20 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 21 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
21 #include "webrtc/frame_callback.h" | 22 #include "webrtc/frame_callback.h" |
22 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" | 23 #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" |
23 #include "webrtc/system_wrappers/interface/clock.h" | 24 #include "webrtc/system_wrappers/interface/clock.h" |
24 #include "webrtc/system_wrappers/interface/cpu_info.h" | 25 #include "webrtc/system_wrappers/interface/cpu_info.h" |
25 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 26 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
26 #include "webrtc/system_wrappers/interface/event_wrapper.h" | 27 #include "webrtc/system_wrappers/interface/event_wrapper.h" |
27 #include "webrtc/system_wrappers/interface/sleep.h" | 28 #include "webrtc/system_wrappers/interface/sleep.h" |
28 #include "webrtc/test/call_test.h" | |
29 #include "webrtc/test/direct_transport.h" | |
30 #include "webrtc/test/encoder_settings.h" | 29 #include "webrtc/test/encoder_settings.h" |
31 #include "webrtc/test/fake_encoder.h" | 30 #include "webrtc/test/fake_encoder.h" |
32 #include "webrtc/test/frame_generator.h" | 31 #include "webrtc/test/frame_generator.h" |
33 #include "webrtc/test/frame_generator_capturer.h" | 32 #include "webrtc/test/frame_generator_capturer.h" |
34 #include "webrtc/test/statistics.h" | 33 #include "webrtc/test/statistics.h" |
35 #include "webrtc/test/testsupport/fileutils.h" | 34 #include "webrtc/test/testsupport/fileutils.h" |
36 #include "webrtc/typedefs.h" | 35 #include "webrtc/typedefs.h" |
| 36 #include "webrtc/video/full_stack.h" |
37 | 37 |
38 namespace webrtc { | 38 namespace webrtc { |
39 | 39 |
40 static const int kFullStackTestDurationSecs = 60; | 40 static const int kFullStackTestDurationSecs = 60; |
41 static const int kSendStatsPollingIntervalMs = 1000; | 41 static const int kSendStatsPollingIntervalMs = 1000; |
42 | 42 |
43 enum class ContentMode { | |
44 kRealTimeVideo, | |
45 kScreensharingStaticImage, | |
46 kScreensharingScrollingImage, | |
47 }; | |
48 | |
49 struct FullStackTestParams { | |
50 const char* test_label; | |
51 struct { | |
52 const char* name; | |
53 size_t width, height; | |
54 int fps; | |
55 } clip; | |
56 ContentMode mode; | |
57 int min_bitrate_bps; | |
58 int target_bitrate_bps; | |
59 int max_bitrate_bps; | |
60 double avg_psnr_threshold; | |
61 double avg_ssim_threshold; | |
62 int test_durations_secs; | |
63 std::string codec; | |
64 FakeNetworkPipe::Config link; | |
65 }; | |
66 | |
67 class FullStackTest : public test::CallTest { | |
68 protected: | |
69 void RunTest(const FullStackTestParams& params); | |
70 }; | |
71 | |
72 class VideoAnalyzer : public PacketReceiver, | 43 class VideoAnalyzer : public PacketReceiver, |
73 public newapi::Transport, | 44 public newapi::Transport, |
74 public VideoRenderer, | 45 public VideoRenderer, |
75 public VideoCaptureInput, | 46 public VideoCaptureInput, |
76 public EncodedFrameObserver { | 47 public EncodedFrameObserver { |
77 public: | 48 public: |
78 VideoAnalyzer(VideoCaptureInput* input, | 49 VideoAnalyzer(VideoCaptureInput* input, |
79 Transport* transport, | 50 Transport* transport, |
80 const char* test_label, | 51 const char* test_label, |
81 double avg_psnr_threshold, | 52 double avg_psnr_threshold, |
82 double avg_ssim_threshold, | 53 double avg_ssim_threshold, |
83 int duration_frames) | 54 int duration_frames, |
| 55 const std::string& graph_data_output_filename) |
84 : input_(input), | 56 : input_(input), |
85 transport_(transport), | 57 transport_(transport), |
86 receiver_(nullptr), | 58 receiver_(nullptr), |
87 send_stream_(nullptr), | 59 send_stream_(nullptr), |
88 test_label_(test_label), | 60 test_label_(test_label), |
| 61 graph_data_output_filename_(graph_data_output_filename), |
89 frames_to_process_(duration_frames), | 62 frames_to_process_(duration_frames), |
90 frames_recorded_(0), | 63 frames_recorded_(0), |
91 frames_processed_(0), | 64 frames_processed_(0), |
92 dropped_frames_(0), | 65 dropped_frames_(0), |
93 last_render_time_(0), | 66 last_render_time_(0), |
94 rtp_timestamp_delta_(0), | 67 rtp_timestamp_delta_(0), |
95 avg_psnr_threshold_(avg_psnr_threshold), | 68 avg_psnr_threshold_(avg_psnr_threshold), |
96 avg_ssim_threshold_(avg_ssim_threshold), | 69 avg_ssim_threshold_(avg_ssim_threshold), |
97 comparison_available_event_(EventWrapper::Create()), | 70 comparison_available_event_(EventWrapper::Create()), |
98 done_(EventWrapper::Create()) { | 71 done_(EventWrapper::Create()) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 RTPHeader header; | 143 RTPHeader header; |
171 parser->Parse(packet, length, &header); | 144 parser->Parse(packet, length, &header); |
172 | 145 |
173 { | 146 { |
174 rtc::CritScope lock(&crit_); | 147 rtc::CritScope lock(&crit_); |
175 if (rtp_timestamp_delta_ == 0) { | 148 if (rtp_timestamp_delta_ == 0) { |
176 rtp_timestamp_delta_ = | 149 rtp_timestamp_delta_ = |
177 header.timestamp - first_send_frame_.timestamp(); | 150 header.timestamp - first_send_frame_.timestamp(); |
178 first_send_frame_.Reset(); | 151 first_send_frame_.Reset(); |
179 } | 152 } |
180 send_times_[header.timestamp - rtp_timestamp_delta_] = | 153 uint32_t timestamp = header.timestamp - rtp_timestamp_delta_; |
| 154 send_times_[timestamp] = |
181 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); | 155 Clock::GetRealTimeClock()->CurrentNtpInMilliseconds(); |
| 156 encoded_frame_sizes_[timestamp] += |
| 157 length - (header.headerLength + header.paddingLength); |
182 } | 158 } |
183 | 159 |
184 return transport_->SendRtp(packet, length); | 160 return transport_->SendRtp(packet, length); |
185 } | 161 } |
186 | 162 |
187 bool SendRtcp(const uint8_t* packet, size_t length) override { | 163 bool SendRtcp(const uint8_t* packet, size_t length) override { |
188 return transport_->SendRtcp(packet, length); | 164 return transport_->SendRtcp(packet, length); |
189 } | 165 } |
190 | 166 |
191 void EncodedFrameCallback(const EncodedFrame& frame) override { | 167 void EncodedFrameCallback(const EncodedFrame& frame) override { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 240 } |
265 | 241 |
266 VideoCaptureInput* input_; | 242 VideoCaptureInput* input_; |
267 Transport* transport_; | 243 Transport* transport_; |
268 PacketReceiver* receiver_; | 244 PacketReceiver* receiver_; |
269 VideoSendStream* send_stream_; | 245 VideoSendStream* send_stream_; |
270 | 246 |
271 private: | 247 private: |
272 struct FrameComparison { | 248 struct FrameComparison { |
273 FrameComparison() | 249 FrameComparison() |
274 : dropped(false), send_time_ms(0), recv_time_ms(0), render_time_ms(0) {} | 250 : dropped(false), |
| 251 send_time_ms(0), |
| 252 recv_time_ms(0), |
| 253 render_time_ms(0), |
| 254 encoded_frame_size(0) {} |
275 | 255 |
276 FrameComparison(const VideoFrame& reference, | 256 FrameComparison(const VideoFrame& reference, |
277 const VideoFrame& render, | 257 const VideoFrame& render, |
278 bool dropped, | 258 bool dropped, |
279 int64_t send_time_ms, | 259 int64_t send_time_ms, |
280 int64_t recv_time_ms, | 260 int64_t recv_time_ms, |
281 int64_t render_time_ms) | 261 int64_t render_time_ms, |
| 262 size_t encoded_frame_size) |
282 : reference(reference), | 263 : reference(reference), |
283 render(render), | 264 render(render), |
284 dropped(dropped), | 265 dropped(dropped), |
285 send_time_ms(send_time_ms), | 266 send_time_ms(send_time_ms), |
286 recv_time_ms(recv_time_ms), | 267 recv_time_ms(recv_time_ms), |
287 render_time_ms(render_time_ms) {} | 268 render_time_ms(render_time_ms), |
| 269 encoded_frame_size(encoded_frame_size) {} |
288 | 270 |
289 VideoFrame reference; | 271 VideoFrame reference; |
290 VideoFrame render; | 272 VideoFrame render; |
291 bool dropped; | 273 bool dropped; |
292 int64_t send_time_ms; | 274 int64_t send_time_ms; |
293 int64_t recv_time_ms; | 275 int64_t recv_time_ms; |
294 int64_t render_time_ms; | 276 int64_t render_time_ms; |
| 277 size_t encoded_frame_size; |
| 278 }; |
| 279 |
| 280 struct Sample { |
| 281 Sample(double dropped, |
| 282 double input_time_ms, |
| 283 double send_time_ms, |
| 284 double recv_time_ms, |
| 285 double encoded_frame_size, |
| 286 double psnr, |
| 287 double ssim, |
| 288 double render_time_ms) |
| 289 : dropped(dropped), |
| 290 input_time_ms(input_time_ms), |
| 291 send_time_ms(send_time_ms), |
| 292 recv_time_ms(recv_time_ms), |
| 293 encoded_frame_size(encoded_frame_size), |
| 294 psnr(psnr), |
| 295 ssim(ssim), |
| 296 render_time_ms(render_time_ms) {} |
| 297 |
| 298 double dropped; |
| 299 double input_time_ms; |
| 300 double send_time_ms; |
| 301 double recv_time_ms; |
| 302 double encoded_frame_size; |
| 303 double psnr; |
| 304 double ssim; |
| 305 double render_time_ms; |
295 }; | 306 }; |
296 | 307 |
297 void AddFrameComparison(const VideoFrame& reference, | 308 void AddFrameComparison(const VideoFrame& reference, |
298 const VideoFrame& render, | 309 const VideoFrame& render, |
299 bool dropped, | 310 bool dropped, |
300 int64_t render_time_ms) | 311 int64_t render_time_ms) |
301 EXCLUSIVE_LOCKS_REQUIRED(crit_) { | 312 EXCLUSIVE_LOCKS_REQUIRED(crit_) { |
302 int64_t send_time_ms = send_times_[reference.timestamp()]; | 313 int64_t send_time_ms = send_times_[reference.timestamp()]; |
303 send_times_.erase(reference.timestamp()); | 314 send_times_.erase(reference.timestamp()); |
304 int64_t recv_time_ms = recv_times_[reference.timestamp()]; | 315 int64_t recv_time_ms = recv_times_[reference.timestamp()]; |
305 recv_times_.erase(reference.timestamp()); | 316 recv_times_.erase(reference.timestamp()); |
306 | 317 |
| 318 size_t encoded_size = encoded_frame_sizes_[reference.timestamp()]; |
| 319 encoded_frame_sizes_.erase(reference.timestamp()); |
| 320 |
| 321 VideoFrame reference_copy; |
| 322 VideoFrame render_copy; |
| 323 reference_copy.CopyFrame(reference); |
| 324 render_copy.CopyFrame(render); |
| 325 |
307 rtc::CritScope crit(&comparison_lock_); | 326 rtc::CritScope crit(&comparison_lock_); |
308 comparisons_.push_back(FrameComparison(reference, render, dropped, | 327 comparisons_.push_back(FrameComparison(reference_copy, render_copy, dropped, |
309 send_time_ms, recv_time_ms, | 328 send_time_ms, recv_time_ms, |
310 render_time_ms)); | 329 render_time_ms, encoded_size)); |
311 comparison_available_event_->Set(); | 330 comparison_available_event_->Set(); |
312 } | 331 } |
313 | 332 |
314 static bool PollStatsThread(void* obj) { | 333 static bool PollStatsThread(void* obj) { |
315 return static_cast<VideoAnalyzer*>(obj)->PollStats(); | 334 return static_cast<VideoAnalyzer*>(obj)->PollStats(); |
316 } | 335 } |
317 | 336 |
318 bool PollStats() { | 337 bool PollStats() { |
319 switch (done_->Wait(kSendStatsPollingIntervalMs)) { | 338 switch (done_->Wait(kSendStatsPollingIntervalMs)) { |
320 case kEventSignaled: | 339 case kEventSignaled: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 comparison_available_event_->Set(); | 377 comparison_available_event_->Set(); |
359 return false; | 378 return false; |
360 } | 379 } |
361 return true; // Try again. | 380 return true; // Try again. |
362 } | 381 } |
363 | 382 |
364 PerformFrameComparison(comparison); | 383 PerformFrameComparison(comparison); |
365 | 384 |
366 if (FrameProcessed()) { | 385 if (FrameProcessed()) { |
367 PrintResults(); | 386 PrintResults(); |
| 387 if (!graph_data_output_filename_.empty()) |
| 388 PrintSamplesToFile(); |
368 done_->Set(); | 389 done_->Set(); |
369 comparison_available_event_->Set(); | 390 comparison_available_event_->Set(); |
370 return false; | 391 return false; |
371 } | 392 } |
372 | 393 |
373 return true; | 394 return true; |
374 } | 395 } |
375 | 396 |
376 bool PopComparison(FrameComparison* comparison) { | 397 bool PopComparison(FrameComparison* comparison) { |
377 rtc::CritScope crit(&comparison_lock_); | 398 rtc::CritScope crit(&comparison_lock_); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 451 |
431 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); | 452 EXPECT_GT(psnr_.Mean(), avg_psnr_threshold_); |
432 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); | 453 EXPECT_GT(ssim_.Mean(), avg_ssim_threshold_); |
433 } | 454 } |
434 | 455 |
435 void PerformFrameComparison(const FrameComparison& comparison) { | 456 void PerformFrameComparison(const FrameComparison& comparison) { |
436 // Perform expensive psnr and ssim calculations while not holding lock. | 457 // Perform expensive psnr and ssim calculations while not holding lock. |
437 double psnr = I420PSNR(&comparison.reference, &comparison.render); | 458 double psnr = I420PSNR(&comparison.reference, &comparison.render); |
438 double ssim = I420SSIM(&comparison.reference, &comparison.render); | 459 double ssim = I420SSIM(&comparison.reference, &comparison.render); |
439 | 460 |
| 461 int64_t input_time_ms = comparison.reference.ntp_time_ms(); |
| 462 |
440 rtc::CritScope crit(&comparison_lock_); | 463 rtc::CritScope crit(&comparison_lock_); |
| 464 if (!graph_data_output_filename_.empty()) { |
| 465 samples_.push_back(Sample( |
| 466 comparison.dropped, input_time_ms, comparison.send_time_ms, |
| 467 comparison.recv_time_ms, comparison.encoded_frame_size, psnr, ssim, |
| 468 comparison.render_time_ms)); |
| 469 } |
441 psnr_.AddSample(psnr); | 470 psnr_.AddSample(psnr); |
442 ssim_.AddSample(ssim); | 471 ssim_.AddSample(ssim); |
| 472 |
443 if (comparison.dropped) { | 473 if (comparison.dropped) { |
444 ++dropped_frames_; | 474 ++dropped_frames_; |
445 return; | 475 return; |
446 } | 476 } |
447 if (last_render_time_ != 0) | 477 if (last_render_time_ != 0) |
448 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_); | 478 rendered_delta_.AddSample(comparison.render_time_ms - last_render_time_); |
449 last_render_time_ = comparison.render_time_ms; | 479 last_render_time_ = comparison.render_time_ms; |
450 | 480 |
451 int64_t input_time_ms = comparison.reference.ntp_time_ms(); | |
452 sender_time_.AddSample(comparison.send_time_ms - input_time_ms); | 481 sender_time_.AddSample(comparison.send_time_ms - input_time_ms); |
453 receiver_time_.AddSample(comparison.render_time_ms - | 482 receiver_time_.AddSample(comparison.render_time_ms - |
454 comparison.recv_time_ms); | 483 comparison.recv_time_ms); |
455 end_to_end_.AddSample(comparison.render_time_ms - input_time_ms); | 484 end_to_end_.AddSample(comparison.render_time_ms - input_time_ms); |
| 485 encoded_frame_size_.AddSample(comparison.encoded_frame_size); |
456 } | 486 } |
457 | 487 |
458 void PrintResult(const char* result_type, | 488 void PrintResult(const char* result_type, |
459 test::Statistics stats, | 489 test::Statistics stats, |
460 const char* unit) { | 490 const char* unit) { |
461 printf("RESULT %s: %s = {%f, %f}%s\n", | 491 printf("RESULT %s: %s = {%f, %f}%s\n", |
462 result_type, | 492 result_type, |
463 test_label_, | 493 test_label_, |
464 stats.Mean(), | 494 stats.Mean(), |
465 stats.StandardDeviation(), | 495 stats.StandardDeviation(), |
466 unit); | 496 unit); |
467 } | 497 } |
468 | 498 |
| 499 void PrintSamplesToFile(void) { |
| 500 FILE* out = fopen(graph_data_output_filename_.c_str(), "w"); |
| 501 CHECK(out != nullptr) |
| 502 << "Couldn't open file: " << graph_data_output_filename_; |
| 503 |
| 504 rtc::CritScope crit(&comparison_lock_); |
| 505 std::sort(samples_.begin(), samples_.end(), |
| 506 [](const Sample& A, const Sample& B) |
| 507 -> bool { return A.input_time_ms < B.input_time_ms; }); |
| 508 |
| 509 fprintf(out, "%s\n", test_label_); |
| 510 fprintf(out, "%" PRIuS "\n", samples_.size()); |
| 511 fprintf(out, |
| 512 "dropped " |
| 513 "input_time_ms " |
| 514 "send_time_ms " |
| 515 "recv_time_ms " |
| 516 "encoded_frame_size " |
| 517 "psnr " |
| 518 "ssim " |
| 519 "render_time_ms\n"); |
| 520 for (const Sample& sample : samples_) { |
| 521 fprintf(out, "%lf %lf %lf %lf %lf %lf %lf %lf\n", sample.dropped, |
| 522 sample.input_time_ms, sample.send_time_ms, sample.recv_time_ms, |
| 523 sample.encoded_frame_size, sample.psnr, sample.ssim, |
| 524 sample.render_time_ms); |
| 525 } |
| 526 fclose(out); |
| 527 } |
| 528 |
469 const char* const test_label_; | 529 const char* const test_label_; |
| 530 std::string graph_data_output_filename_; |
| 531 std::vector<Sample> samples_ GUARDED_BY(comparison_lock_); |
470 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); | 532 test::Statistics sender_time_ GUARDED_BY(comparison_lock_); |
471 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); | 533 test::Statistics receiver_time_ GUARDED_BY(comparison_lock_); |
472 test::Statistics psnr_ GUARDED_BY(comparison_lock_); | 534 test::Statistics psnr_ GUARDED_BY(comparison_lock_); |
473 test::Statistics ssim_ GUARDED_BY(comparison_lock_); | 535 test::Statistics ssim_ GUARDED_BY(comparison_lock_); |
474 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); | 536 test::Statistics end_to_end_ GUARDED_BY(comparison_lock_); |
475 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); | 537 test::Statistics rendered_delta_ GUARDED_BY(comparison_lock_); |
476 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); | 538 test::Statistics encoded_frame_size_ GUARDED_BY(comparison_lock_); |
477 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); | 539 test::Statistics encode_frame_rate_ GUARDED_BY(comparison_lock_); |
478 test::Statistics encode_time_ms GUARDED_BY(comparison_lock_); | 540 test::Statistics encode_time_ms GUARDED_BY(comparison_lock_); |
479 test::Statistics encode_usage_percent GUARDED_BY(comparison_lock_); | 541 test::Statistics encode_usage_percent GUARDED_BY(comparison_lock_); |
480 test::Statistics media_bitrate_bps GUARDED_BY(comparison_lock_); | 542 test::Statistics media_bitrate_bps GUARDED_BY(comparison_lock_); |
481 | 543 |
482 const int frames_to_process_; | 544 const int frames_to_process_; |
483 int frames_recorded_; | 545 int frames_recorded_; |
484 int frames_processed_; | 546 int frames_processed_; |
485 int dropped_frames_; | 547 int dropped_frames_; |
486 int64_t last_render_time_; | 548 int64_t last_render_time_; |
487 uint32_t rtp_timestamp_delta_; | 549 uint32_t rtp_timestamp_delta_; |
488 | 550 |
489 rtc::CriticalSection crit_; | 551 rtc::CriticalSection crit_; |
490 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); | 552 std::deque<VideoFrame> frames_ GUARDED_BY(crit_); |
| 553 std::deque<VideoSendStream::Stats> send_stats_ GUARDED_BY(crit_); |
491 VideoFrame last_rendered_frame_ GUARDED_BY(crit_); | 554 VideoFrame last_rendered_frame_ GUARDED_BY(crit_); |
492 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_); | 555 std::map<uint32_t, int64_t> send_times_ GUARDED_BY(crit_); |
493 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_); | 556 std::map<uint32_t, int64_t> recv_times_ GUARDED_BY(crit_); |
| 557 std::map<uint32_t, size_t> encoded_frame_sizes_ GUARDED_BY(crit_); |
494 VideoFrame first_send_frame_ GUARDED_BY(crit_); | 558 VideoFrame first_send_frame_ GUARDED_BY(crit_); |
495 const double avg_psnr_threshold_; | 559 const double avg_psnr_threshold_; |
496 const double avg_ssim_threshold_; | 560 const double avg_ssim_threshold_; |
497 | 561 |
498 rtc::CriticalSection comparison_lock_; | 562 rtc::CriticalSection comparison_lock_; |
499 std::vector<ThreadWrapper*> comparison_thread_pool_; | 563 std::vector<ThreadWrapper*> comparison_thread_pool_; |
500 rtc::scoped_ptr<ThreadWrapper> stats_polling_thread_; | 564 rtc::scoped_ptr<ThreadWrapper> stats_polling_thread_; |
501 const rtc::scoped_ptr<EventWrapper> comparison_available_event_; | 565 const rtc::scoped_ptr<EventWrapper> comparison_available_event_; |
502 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); | 566 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); |
503 const rtc::scoped_ptr<EventWrapper> done_; | 567 const rtc::scoped_ptr<EventWrapper> done_; |
504 }; | 568 }; |
505 | 569 |
506 void FullStackTest::RunTest(const FullStackTestParams& params) { | 570 void FullStackTest::RunTest(const FullStackTestParams& params) { |
| 571 // TODO(ivica): Add num_temporal_layers as a param. |
| 572 unsigned char num_temporal_layers = |
| 573 params.graph_data_output_filename.empty() ? 2 : 1; |
| 574 |
507 test::DirectTransport send_transport(params.link); | 575 test::DirectTransport send_transport(params.link); |
508 test::DirectTransport recv_transport(params.link); | 576 test::DirectTransport recv_transport(params.link); |
509 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label, | 577 VideoAnalyzer analyzer(nullptr, &send_transport, params.test_label, |
510 params.avg_psnr_threshold, params.avg_ssim_threshold, | 578 params.avg_psnr_threshold, params.avg_ssim_threshold, |
511 params.test_durations_secs * params.clip.fps); | 579 params.test_durations_secs * params.clip.fps, |
| 580 params.graph_data_output_filename); |
512 | 581 |
513 CreateCalls(Call::Config(), Call::Config()); | 582 CreateCalls(Call::Config(), Call::Config()); |
514 | 583 |
515 analyzer.SetReceiver(receiver_call_->Receiver()); | 584 analyzer.SetReceiver(receiver_call_->Receiver()); |
516 send_transport.SetReceiver(&analyzer); | 585 send_transport.SetReceiver(&analyzer); |
517 recv_transport.SetReceiver(sender_call_->Receiver()); | 586 recv_transport.SetReceiver(sender_call_->Receiver()); |
518 | 587 |
519 CreateSendConfig(1, &analyzer); | 588 CreateSendConfig(1, &analyzer); |
520 | 589 |
521 rtc::scoped_ptr<VideoEncoder> encoder; | 590 rtc::scoped_ptr<VideoEncoder> encoder; |
(...skipping 28 matching lines...) Expand all Loading... |
550 VideoCodecVP8 vp8_settings; | 619 VideoCodecVP8 vp8_settings; |
551 VideoCodecVP9 vp9_settings; | 620 VideoCodecVP9 vp9_settings; |
552 if (params.mode == ContentMode::kScreensharingStaticImage || | 621 if (params.mode == ContentMode::kScreensharingStaticImage || |
553 params.mode == ContentMode::kScreensharingScrollingImage) { | 622 params.mode == ContentMode::kScreensharingScrollingImage) { |
554 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 623 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
555 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; | 624 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; |
556 if (params.codec == "VP8") { | 625 if (params.codec == "VP8") { |
557 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 626 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
558 vp8_settings.denoisingOn = false; | 627 vp8_settings.denoisingOn = false; |
559 vp8_settings.frameDroppingOn = false; | 628 vp8_settings.frameDroppingOn = false; |
560 vp8_settings.numberOfTemporalLayers = 2; | 629 vp8_settings.numberOfTemporalLayers = num_temporal_layers; |
561 encoder_config_.encoder_specific_settings = &vp8_settings; | 630 encoder_config_.encoder_specific_settings = &vp8_settings; |
562 } else if (params.codec == "VP9") { | 631 } else if (params.codec == "VP9") { |
563 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 632 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
564 vp9_settings.denoisingOn = false; | 633 vp9_settings.denoisingOn = false; |
565 vp9_settings.frameDroppingOn = false; | 634 vp9_settings.frameDroppingOn = false; |
566 vp9_settings.numberOfTemporalLayers = 2; | 635 vp9_settings.numberOfTemporalLayers = num_temporal_layers; |
567 encoder_config_.encoder_specific_settings = &vp9_settings; | 636 encoder_config_.encoder_specific_settings = &vp9_settings; |
568 } | 637 } |
569 | 638 |
570 stream->temporal_layer_thresholds_bps.clear(); | 639 stream->temporal_layer_thresholds_bps.clear(); |
571 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); | 640 if (num_temporal_layers > 1) { |
| 641 stream->temporal_layer_thresholds_bps.push_back( |
| 642 stream->target_bitrate_bps); |
| 643 } |
572 } | 644 } |
573 | 645 |
574 CreateMatchingReceiveConfigs(&recv_transport); | 646 CreateMatchingReceiveConfigs(&recv_transport); |
575 receive_configs_[0].renderer = &analyzer; | 647 receive_configs_[0].renderer = &analyzer; |
576 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 648 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
577 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; | 649 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; |
578 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = | 650 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = |
579 kSendRtxPayloadType; | 651 kSendRtxPayloadType; |
580 | 652 |
581 for (auto& config : receive_configs_) | 653 for (auto& config : receive_configs_) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 50000, | 878 50000, |
807 200000, | 879 200000, |
808 2000000, | 880 2000000, |
809 0.0, | 881 0.0, |
810 0.0, | 882 0.0, |
811 kFullStackTestDurationSecs, | 883 kFullStackTestDurationSecs, |
812 "VP9"}; | 884 "VP9"}; |
813 RunTest(screenshare_params); | 885 RunTest(screenshare_params); |
814 } | 886 } |
815 } // namespace webrtc | 887 } // namespace webrtc |
OLD | NEW |