Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2573453002: Add multithreaded fake encoder and corresponding FlexFEC VideoSendStreamTest. (Closed)
Patch Set: Add the test here. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« webrtc/test/fake_encoder.cc ('K') | « webrtc/test/fake_encoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> // max 10 #include <algorithm> // max
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 bool expect_ulpfec, 358 bool expect_ulpfec,
359 const std::string& codec) 359 const std::string& codec)
360 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs), 360 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs),
361 payload_name_(codec), 361 payload_name_(codec),
362 use_nack_(use_nack), 362 use_nack_(use_nack),
363 expect_red_(expect_red), 363 expect_red_(expect_red),
364 expect_ulpfec_(expect_ulpfec), 364 expect_ulpfec_(expect_ulpfec),
365 sent_media_(false), 365 sent_media_(false),
366 sent_ulpfec_(false), 366 sent_ulpfec_(false),
367 header_extensions_enabled_(header_extensions_enabled) { 367 header_extensions_enabled_(header_extensions_enabled) {
368 if (codec == "H264") { 368 if (codec == "MTFE") {
stefan-webrtc 2016/12/12 15:18:28 I think this is a bit ugly. Can we pass in the obj
brandtr 2016/12/13 11:32:23 We could, but it seems that I would still need to
stefan-webrtc 2016/12/13 13:04:46 Right, but you can then just call it H264, instead
brandtr 2016/12/14 10:13:50 Yep. I also made it a FakeH264Encoder, so I'm not
stefan-webrtc 2016/12/14 11:42:31 This works, but instead of only passing in the pay
brandtr 2016/12/19 08:54:53 Done. This made the test instantiations more verbo
369 encoder_.reset(
370 new test::MultiThreadedFakeEncoder(Clock::GetRealTimeClock()));
371 } else if (codec == "H264") {
369 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock())); 372 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock()));
370 } else if (codec == "VP8") { 373 } else if (codec == "VP8") {
371 encoder_.reset(VP8Encoder::Create()); 374 encoder_.reset(VP8Encoder::Create());
372 } else if (codec == "VP9") { 375 } else if (codec == "VP9") {
373 encoder_.reset(VP9Encoder::Create()); 376 encoder_.reset(VP9Encoder::Create());
374 } else { 377 } else {
375 RTC_NOTREACHED(); 378 RTC_NOTREACHED();
376 } 379 }
377 } 380 }
378 381
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 RunBaseTest(&test); 530 RunBaseTest(&test);
528 } 531 }
529 532
530 #if !defined(RTC_DISABLE_VP9) 533 #if !defined(RTC_DISABLE_VP9)
531 TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp9WithNackEnabled) { 534 TEST_F(VideoSendStreamTest, DoesUtilizeUlpfecForVp9WithNackEnabled) {
532 UlpfecObserver test(false, true, true, true, "VP9"); 535 UlpfecObserver test(false, true, true, true, "VP9");
533 RunBaseTest(&test); 536 RunBaseTest(&test);
534 } 537 }
535 #endif // !defined(RTC_DISABLE_VP9) 538 #endif // !defined(RTC_DISABLE_VP9)
536 539
540 TEST_F(VideoSendStreamTest, SupportsUlpfecMTFE) {
541 UlpfecObserver test(false, false, true, true, "MTFE");
542 RunBaseTest(&test);
543 }
544
537 // TODO(brandtr): Move these FlexFEC tests when we have created 545 // TODO(brandtr): Move these FlexFEC tests when we have created
538 // FlexfecSendStream. 546 // FlexfecSendStream.
539 class FlexfecObserver : public test::EndToEndTest { 547 class FlexfecObserver : public test::EndToEndTest {
540 public: 548 public:
541 FlexfecObserver(bool header_extensions_enabled, 549 FlexfecObserver(bool header_extensions_enabled,
542 bool use_nack, 550 bool use_nack,
543 const std::string& codec) 551 const std::string& codec)
544 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs), 552 : EndToEndTest(VideoSendStreamTest::kDefaultTimeoutMs),
545 payload_name_(codec), 553 payload_name_(codec),
546 use_nack_(use_nack), 554 use_nack_(use_nack),
547 sent_media_(false), 555 sent_media_(false),
548 sent_flexfec_(false), 556 sent_flexfec_(false),
549 header_extensions_enabled_(header_extensions_enabled) { 557 header_extensions_enabled_(header_extensions_enabled) {
550 if (codec == "H264") { 558 if (codec == "MTFE") {
559 encoder_.reset(
560 new test::MultiThreadedFakeEncoder(Clock::GetRealTimeClock()));
561 } else if (codec == "H264") {
551 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock())); 562 encoder_.reset(new test::FakeH264Encoder(Clock::GetRealTimeClock()));
552 } else if (codec == "VP8") { 563 } else if (codec == "VP8") {
553 encoder_.reset(VP8Encoder::Create()); 564 encoder_.reset(VP8Encoder::Create());
554 } else if (codec == "VP9") { 565 } else if (codec == "VP9") {
555 encoder_.reset(VP9Encoder::Create()); 566 encoder_.reset(VP9Encoder::Create());
556 } else { 567 } else {
557 RTC_NOTREACHED(); 568 RTC_NOTREACHED();
558 } 569 }
559 } 570 }
560 571
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 TEST_F(VideoSendStreamTest, SupportsFlexfecH264) { 679 TEST_F(VideoSendStreamTest, SupportsFlexfecH264) {
669 FlexfecObserver test(false, false, "H264"); 680 FlexfecObserver test(false, false, "H264");
670 RunBaseTest(&test); 681 RunBaseTest(&test);
671 } 682 }
672 683
673 TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackH264) { 684 TEST_F(VideoSendStreamTest, SupportsFlexfecWithNackH264) {
674 FlexfecObserver test(false, true, "H264"); 685 FlexfecObserver test(false, true, "H264");
675 RunBaseTest(&test); 686 RunBaseTest(&test);
676 } 687 }
677 688
689 TEST_F(VideoSendStreamTest, SupportsFlexfecMTFE) {
690 FlexfecObserver test(false, false, "MTFE");
691 RunBaseTest(&test);
692 }
693
678 void VideoSendStreamTest::TestNackRetransmission( 694 void VideoSendStreamTest::TestNackRetransmission(
679 uint32_t retransmit_ssrc, 695 uint32_t retransmit_ssrc,
680 uint8_t retransmit_payload_type) { 696 uint8_t retransmit_payload_type) {
681 class NackObserver : public test::SendTest { 697 class NackObserver : public test::SendTest {
682 public: 698 public:
683 explicit NackObserver(uint32_t retransmit_ssrc, 699 explicit NackObserver(uint32_t retransmit_ssrc,
684 uint8_t retransmit_payload_type) 700 uint8_t retransmit_payload_type)
685 : SendTest(kDefaultTimeoutMs), 701 : SendTest(kDefaultTimeoutMs),
686 send_count_(0), 702 send_count_(0),
687 retransmit_ssrc_(retransmit_ssrc), 703 retransmit_ssrc_(retransmit_ssrc),
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 private: 3227 private:
3212 Call* call_; 3228 Call* call_;
3213 rtc::CriticalSection crit_; 3229 rtc::CriticalSection crit_;
3214 uint32_t max_bitrate_kbps_ GUARDED_BY(&crit_); 3230 uint32_t max_bitrate_kbps_ GUARDED_BY(&crit_);
3215 } test; 3231 } test;
3216 3232
3217 RunBaseTest(&test); 3233 RunBaseTest(&test);
3218 } 3234 }
3219 3235
3220 } // namespace webrtc 3236 } // namespace webrtc
OLDNEW
« webrtc/test/fake_encoder.cc ('K') | « webrtc/test/fake_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698