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

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

Issue 1573453002: Add CreateSend/ReceiveTransport() methods to CallTest. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months 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
« no previous file with comments | « webrtc/test/call_test.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | 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> 10 #include <algorithm>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 277
278 bool IsTextureSupported() const override { return false; } 278 bool IsTextureSupported() const override { return false; }
279 279
280 private: 280 private:
281 rtc::scoped_ptr<webrtc::VideoEncoder> encoder_; 281 rtc::scoped_ptr<webrtc::VideoEncoder> encoder_;
282 rtc::scoped_ptr<webrtc::VideoDecoder> decoder_; 282 rtc::scoped_ptr<webrtc::VideoDecoder> decoder_;
283 int frame_counter_; 283 int frame_counter_;
284 } test; 284 } test;
285 285
286 RunBaseTest(&test, FakeNetworkPipe::Config()); 286 RunBaseTest(&test);
287 } 287 }
288 288
289 TEST_F(EndToEndTest, SendsAndReceivesH264) { 289 TEST_F(EndToEndTest, SendsAndReceivesH264) {
290 class H264Observer : public test::EndToEndTest, public VideoRenderer { 290 class H264Observer : public test::EndToEndTest, public VideoRenderer {
291 public: 291 public:
292 H264Observer() 292 H264Observer()
293 : EndToEndTest(2 * kDefaultTimeoutMs), 293 : EndToEndTest(2 * kDefaultTimeoutMs),
294 fake_encoder_(Clock::GetRealTimeClock()), 294 fake_encoder_(Clock::GetRealTimeClock()),
295 frame_counter_(0) {} 295 frame_counter_(0) {}
296 296
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 329 }
330 330
331 bool IsTextureSupported() const override { return false; } 331 bool IsTextureSupported() const override { return false; }
332 332
333 private: 333 private:
334 test::FakeH264Decoder fake_decoder_; 334 test::FakeH264Decoder fake_decoder_;
335 test::FakeH264Encoder fake_encoder_; 335 test::FakeH264Encoder fake_encoder_;
336 int frame_counter_; 336 int frame_counter_;
337 } test; 337 } test;
338 338
339 RunBaseTest(&test, FakeNetworkPipe::Config()); 339 RunBaseTest(&test);
340 } 340 }
341 341
342 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { 342 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) {
343 class SyncRtcpObserver : public test::EndToEndTest { 343 class SyncRtcpObserver : public test::EndToEndTest {
344 public: 344 public:
345 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {} 345 SyncRtcpObserver() : EndToEndTest(kDefaultTimeoutMs) {}
346 346
347 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { 347 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
348 RTCPUtility::RTCPParserV2 parser(packet, length, true); 348 RTCPUtility::RTCPParserV2 parser(packet, length, true);
349 EXPECT_TRUE(parser.IsValid()); 349 EXPECT_TRUE(parser.IsValid());
350 uint32_t ssrc = 0; 350 uint32_t ssrc = 0;
351 ssrc |= static_cast<uint32_t>(packet[4]) << 24; 351 ssrc |= static_cast<uint32_t>(packet[4]) << 24;
352 ssrc |= static_cast<uint32_t>(packet[5]) << 16; 352 ssrc |= static_cast<uint32_t>(packet[5]) << 16;
353 ssrc |= static_cast<uint32_t>(packet[6]) << 8; 353 ssrc |= static_cast<uint32_t>(packet[6]) << 8;
354 ssrc |= static_cast<uint32_t>(packet[7]) << 0; 354 ssrc |= static_cast<uint32_t>(packet[7]) << 0;
355 EXPECT_EQ(kReceiverLocalVideoSsrc, ssrc); 355 EXPECT_EQ(kReceiverLocalVideoSsrc, ssrc);
356 observation_complete_.Set(); 356 observation_complete_.Set();
357 357
358 return SEND_PACKET; 358 return SEND_PACKET;
359 } 359 }
360 360
361 void PerformTest() override { 361 void PerformTest() override {
362 EXPECT_TRUE(Wait()) 362 EXPECT_TRUE(Wait())
363 << "Timed out while waiting for a receiver RTCP packet to be sent."; 363 << "Timed out while waiting for a receiver RTCP packet to be sent.";
364 } 364 }
365 } test; 365 } test;
366 366
367 RunBaseTest(&test, FakeNetworkPipe::Config()); 367 RunBaseTest(&test);
368 } 368 }
369 369
370 TEST_F(EndToEndTest, ReceivesAndRetransmitsNack) { 370 TEST_F(EndToEndTest, ReceivesAndRetransmitsNack) {
371 static const int kNumberOfNacksToObserve = 2; 371 static const int kNumberOfNacksToObserve = 2;
372 static const int kLossBurstSize = 2; 372 static const int kLossBurstSize = 2;
373 static const int kPacketsBetweenLossBursts = 9; 373 static const int kPacketsBetweenLossBursts = 9;
374 class NackObserver : public test::EndToEndTest { 374 class NackObserver : public test::EndToEndTest {
375 public: 375 public:
376 NackObserver() 376 NackObserver()
377 : EndToEndTest(kLongTimeoutMs), 377 : EndToEndTest(kLongTimeoutMs),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 447 }
448 448
449 rtc::CriticalSection crit_; 449 rtc::CriticalSection crit_;
450 std::set<uint16_t> dropped_packets_; 450 std::set<uint16_t> dropped_packets_;
451 std::set<uint16_t> retransmitted_packets_; 451 std::set<uint16_t> retransmitted_packets_;
452 uint64_t sent_rtp_packets_; 452 uint64_t sent_rtp_packets_;
453 int packets_left_to_drop_; 453 int packets_left_to_drop_;
454 int nacks_left_ GUARDED_BY(&crit_); 454 int nacks_left_ GUARDED_BY(&crit_);
455 } test; 455 } test;
456 456
457 RunBaseTest(&test, FakeNetworkPipe::Config()); 457 RunBaseTest(&test);
458 } 458 }
459 459
460 TEST_F(EndToEndTest, CanReceiveFec) { 460 TEST_F(EndToEndTest, CanReceiveFec) {
461 class FecRenderObserver : public test::EndToEndTest, public VideoRenderer { 461 class FecRenderObserver : public test::EndToEndTest, public VideoRenderer {
462 public: 462 public:
463 FecRenderObserver() 463 FecRenderObserver()
464 : EndToEndTest(kDefaultTimeoutMs), state_(kFirstPacket) {} 464 : EndToEndTest(kDefaultTimeoutMs), state_(kFirstPacket) {}
465 465
466 private: 466 private:
467 Action OnSendRtp(const uint8_t* packet, size_t length) override { 467 Action OnSendRtp(const uint8_t* packet, size_t length) override {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 void PerformTest() override { 548 void PerformTest() override {
549 EXPECT_TRUE(Wait()) 549 EXPECT_TRUE(Wait())
550 << "Timed out waiting for dropped frames frames to be rendered."; 550 << "Timed out waiting for dropped frames frames to be rendered.";
551 } 551 }
552 552
553 rtc::CriticalSection crit_; 553 rtc::CriticalSection crit_;
554 std::set<uint32_t> protected_sequence_numbers_ GUARDED_BY(crit_); 554 std::set<uint32_t> protected_sequence_numbers_ GUARDED_BY(crit_);
555 std::set<uint32_t> protected_timestamps_ GUARDED_BY(crit_); 555 std::set<uint32_t> protected_timestamps_ GUARDED_BY(crit_);
556 } test; 556 } test;
557 557
558 RunBaseTest(&test, FakeNetworkPipe::Config()); 558 RunBaseTest(&test);
559 } 559 }
560 560
561 // Flacky on all platforms. See webrtc:4328. 561 // Flacky on all platforms. See webrtc:4328.
562 TEST_F(EndToEndTest, DISABLED_ReceivedFecPacketsNotNacked) { 562 TEST_F(EndToEndTest, DISABLED_ReceivedFecPacketsNotNacked) {
563 class FecNackObserver : public test::EndToEndTest { 563 class FecNackObserver : public test::EndToEndTest {
564 public: 564 public:
565 FecNackObserver() 565 FecNackObserver()
566 : EndToEndTest(kDefaultTimeoutMs), 566 : EndToEndTest(kDefaultTimeoutMs),
567 state_(kFirstPacket), 567 state_(kFirstPacket),
568 fec_sequence_number_(0), 568 fec_sequence_number_(0),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 if (!nacks.empty() && 630 if (!nacks.empty() &&
631 IsNewerSequenceNumber(nacks.back(), fec_sequence_number_)) { 631 IsNewerSequenceNumber(nacks.back(), fec_sequence_number_)) {
632 EXPECT_TRUE(std::find( 632 EXPECT_TRUE(std::find(
633 nacks.begin(), nacks.end(), fec_sequence_number_) == nacks.end()); 633 nacks.begin(), nacks.end(), fec_sequence_number_) == nacks.end());
634 observation_complete_.Set(); 634 observation_complete_.Set();
635 } 635 }
636 } 636 }
637 return SEND_PACKET; 637 return SEND_PACKET;
638 } 638 }
639 639
640 test::PacketTransport* CreateSendTransport(Call* sender_call) override {
641 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC.
642 // Configure some network delay.
643 const int kNetworkDelayMs = 50;
644 FakeNetworkPipe::Config config;
645 config.queue_delay_ms = kNetworkDelayMs;
646 return new test::PacketTransport(sender_call, this,
647 test::PacketTransport::kSender, config);
648 }
649
640 // TODO(holmer): Investigate why we don't send FEC packets when the bitrate 650 // TODO(holmer): Investigate why we don't send FEC packets when the bitrate
641 // is 10 kbps. 651 // is 10 kbps.
642 Call::Config GetSenderCallConfig() override { 652 Call::Config GetSenderCallConfig() override {
643 Call::Config config; 653 Call::Config config;
644 const int kMinBitrateBps = 30000; 654 const int kMinBitrateBps = 30000;
645 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; 655 config.bitrate_config.min_bitrate_bps = kMinBitrateBps;
646 return config; 656 return config;
647 } 657 }
648 658
649 void ModifyVideoConfigs( 659 void ModifyVideoConfigs(
(...skipping 20 matching lines...) Expand all
670 kDropAllMediaPacketsUntilFec, 680 kDropAllMediaPacketsUntilFec,
671 kVerifyFecPacketNotInNackList, 681 kVerifyFecPacketNotInNackList,
672 } state_; 682 } state_;
673 683
674 rtc::CriticalSection crit_; 684 rtc::CriticalSection crit_;
675 uint16_t fec_sequence_number_ GUARDED_BY(&crit_); 685 uint16_t fec_sequence_number_ GUARDED_BY(&crit_);
676 bool has_last_sequence_number_; 686 bool has_last_sequence_number_;
677 uint16_t last_sequence_number_; 687 uint16_t last_sequence_number_;
678 } test; 688 } test;
679 689
680 // At low RTT (< kLowRttNackMs) -> NACK only, no FEC. 690 RunBaseTest(&test);
681 // Configure some network delay.
682 const int kNetworkDelayMs = 50;
683 FakeNetworkPipe::Config config;
684 config.queue_delay_ms = kNetworkDelayMs;
685 RunBaseTest(&test, config);
686 } 691 }
687 692
688 // This test drops second RTP packet with a marker bit set, makes sure it's 693 // This test drops second RTP packet with a marker bit set, makes sure it's
689 // retransmitted and renders. Retransmission SSRCs are also checked. 694 // retransmitted and renders. Retransmission SSRCs are also checked.
690 void EndToEndTest::DecodesRetransmittedFrame(bool use_rtx, bool use_red) { 695 void EndToEndTest::DecodesRetransmittedFrame(bool use_rtx, bool use_red) {
691 // Must be set high enough to allow the bitrate probing to finish. 696 // Must be set high enough to allow the bitrate probing to finish.
692 static const int kMinProbePackets = 30; 697 static const int kMinProbePackets = 30;
693 static const int kDroppedFrameNumber = kMinProbePackets + 1; 698 static const int kDroppedFrameNumber = kMinProbePackets + 1;
694 class RetransmissionObserver : public test::EndToEndTest, 699 class RetransmissionObserver : public test::EndToEndTest,
695 public I420FrameCallback { 700 public I420FrameCallback {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 rtc::CriticalSection crit_; 789 rtc::CriticalSection crit_;
785 const int payload_type_; 790 const int payload_type_;
786 const uint32_t retransmission_ssrc_; 791 const uint32_t retransmission_ssrc_;
787 const int retransmission_payload_type_; 792 const int retransmission_payload_type_;
788 int marker_bits_observed_; 793 int marker_bits_observed_;
789 int num_packets_observed_; 794 int num_packets_observed_;
790 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); 795 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_);
791 bool frame_retransmitted_; 796 bool frame_retransmitted_;
792 } test(use_rtx, use_red); 797 } test(use_rtx, use_red);
793 798
794 RunBaseTest(&test, FakeNetworkPipe::Config()); 799 RunBaseTest(&test);
795 } 800 }
796 801
797 TEST_F(EndToEndTest, DecodesRetransmittedFrame) { 802 TEST_F(EndToEndTest, DecodesRetransmittedFrame) {
798 DecodesRetransmittedFrame(false, false); 803 DecodesRetransmittedFrame(false, false);
799 } 804 }
800 805
801 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) { 806 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) {
802 DecodesRetransmittedFrame(true, false); 807 DecodesRetransmittedFrame(true, false);
803 } 808 }
804 809
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 } 999 }
995 1000
996 rtc::CriticalSection crit_; 1001 rtc::CriticalSection crit_;
997 int rtp_history_ms_; 1002 int rtp_history_ms_;
998 bool nack_enabled_; 1003 bool nack_enabled_;
999 uint32_t highest_dropped_timestamp_ GUARDED_BY(&crit_); 1004 uint32_t highest_dropped_timestamp_ GUARDED_BY(&crit_);
1000 int frames_to_drop_ GUARDED_BY(&crit_); 1005 int frames_to_drop_ GUARDED_BY(&crit_);
1001 bool received_pli_ GUARDED_BY(&crit_); 1006 bool received_pli_ GUARDED_BY(&crit_);
1002 } test(rtp_history_ms); 1007 } test(rtp_history_ms);
1003 1008
1004 RunBaseTest(&test, FakeNetworkPipe::Config()); 1009 RunBaseTest(&test);
1005 } 1010 }
1006 1011
1007 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithNack) { 1012 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithNack) {
1008 ReceivesPliAndRecovers(1000); 1013 ReceivesPliAndRecovers(1000);
1009 } 1014 }
1010 1015
1011 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithoutNack) { 1016 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithoutNack) {
1012 ReceivesPliAndRecovers(0); 1017 ReceivesPliAndRecovers(0);
1013 } 1018 }
1014 1019
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 << (rtcp_mode_ == RtcpMode::kCompound 1147 << (rtcp_mode_ == RtcpMode::kCompound
1143 ? "Timed out before observing enough compound packets." 1148 ? "Timed out before observing enough compound packets."
1144 : "Timed out before receiving a non-compound RTCP packet."); 1149 : "Timed out before receiving a non-compound RTCP packet.");
1145 } 1150 }
1146 1151
1147 RtcpMode rtcp_mode_; 1152 RtcpMode rtcp_mode_;
1148 int sent_rtp_; 1153 int sent_rtp_;
1149 int sent_rtcp_; 1154 int sent_rtcp_;
1150 } test(rtcp_mode); 1155 } test(rtcp_mode);
1151 1156
1152 RunBaseTest(&test, FakeNetworkPipe::Config()); 1157 RunBaseTest(&test);
1153 } 1158 }
1154 1159
1155 TEST_F(EndToEndTest, UsesRtcpCompoundMode) { 1160 TEST_F(EndToEndTest, UsesRtcpCompoundMode) {
1156 RespectsRtcpMode(RtcpMode::kCompound); 1161 RespectsRtcpMode(RtcpMode::kCompound);
1157 } 1162 }
1158 1163
1159 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) { 1164 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) {
1160 RespectsRtcpMode(RtcpMode::kReducedSize); 1165 RespectsRtcpMode(RtcpMode::kReducedSize);
1161 } 1166 }
1162 1167
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 observation_complete_.Set(); 1724 observation_complete_.Set();
1720 return SEND_PACKET; 1725 return SEND_PACKET;
1721 } 1726 }
1722 void PerformTest() override { 1727 void PerformTest() override {
1723 EXPECT_TRUE(Wait()) << "Timed out while waiting for a " 1728 EXPECT_TRUE(Wait()) << "Timed out while waiting for a "
1724 "receiver RTCP REMB packet to be " 1729 "receiver RTCP REMB packet to be "
1725 "sent."; 1730 "sent.";
1726 } 1731 }
1727 } test; 1732 } test;
1728 1733
1729 RunBaseTest(&test, FakeNetworkPipe::Config()); 1734 RunBaseTest(&test);
1730 } 1735 }
1731 1736
1732 TEST_F(EndToEndTest, VerifyBandwidthStats) { 1737 TEST_F(EndToEndTest, VerifyBandwidthStats) {
1733 class RtcpObserver : public test::EndToEndTest { 1738 class RtcpObserver : public test::EndToEndTest {
1734 public: 1739 public:
1735 RtcpObserver() 1740 RtcpObserver()
1736 : EndToEndTest(kDefaultTimeoutMs), 1741 : EndToEndTest(kDefaultTimeoutMs),
1737 sender_call_(nullptr), 1742 sender_call_(nullptr),
1738 receiver_call_(nullptr), 1743 receiver_call_(nullptr),
1739 has_seen_pacer_delay_(false) {} 1744 has_seen_pacer_delay_(false) {}
(...skipping 19 matching lines...) Expand all
1759 EXPECT_TRUE(Wait()) << "Timed out while waiting for " 1764 EXPECT_TRUE(Wait()) << "Timed out while waiting for "
1760 "non-zero bandwidth stats."; 1765 "non-zero bandwidth stats.";
1761 } 1766 }
1762 1767
1763 private: 1768 private:
1764 Call* sender_call_; 1769 Call* sender_call_;
1765 Call* receiver_call_; 1770 Call* receiver_call_;
1766 bool has_seen_pacer_delay_; 1771 bool has_seen_pacer_delay_;
1767 } test; 1772 } test;
1768 1773
1769 RunBaseTest(&test, FakeNetworkPipe::Config()); 1774 RunBaseTest(&test);
1770 } 1775 }
1771 1776
1772 TEST_F(EndToEndTest, VerifyNackStats) { 1777 TEST_F(EndToEndTest, VerifyNackStats) {
1773 static const int kPacketNumberToDrop = 200; 1778 static const int kPacketNumberToDrop = 200;
1774 class NackObserver : public test::EndToEndTest { 1779 class NackObserver : public test::EndToEndTest {
1775 public: 1780 public:
1776 NackObserver() 1781 NackObserver()
1777 : EndToEndTest(kLongTimeoutMs), 1782 : EndToEndTest(kLongTimeoutMs),
1778 sent_rtp_packets_(0), 1783 sent_rtp_packets_(0),
1779 dropped_rtp_packet_(0), 1784 dropped_rtp_packet_(0),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 rtc::CriticalSection crit_; 1868 rtc::CriticalSection crit_;
1864 uint64_t sent_rtp_packets_; 1869 uint64_t sent_rtp_packets_;
1865 uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_); 1870 uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_);
1866 bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_); 1871 bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_);
1867 std::vector<VideoReceiveStream*> receive_streams_; 1872 std::vector<VideoReceiveStream*> receive_streams_;
1868 VideoSendStream* send_stream_; 1873 VideoSendStream* send_stream_;
1869 int64_t start_runtime_ms_; 1874 int64_t start_runtime_ms_;
1870 } test; 1875 } test;
1871 1876
1872 test::ClearHistograms(); 1877 test::ClearHistograms();
1873 RunBaseTest(&test, FakeNetworkPipe::Config()); 1878 RunBaseTest(&test);
1874 1879
1875 EXPECT_EQ(1, test::NumHistogramSamples( 1880 EXPECT_EQ(1, test::NumHistogramSamples(
1876 "WebRTC.Video.UniqueNackRequestsSentInPercent")); 1881 "WebRTC.Video.UniqueNackRequestsSentInPercent"));
1877 EXPECT_EQ(1, test::NumHistogramSamples( 1882 EXPECT_EQ(1, test::NumHistogramSamples(
1878 "WebRTC.Video.UniqueNackRequestsReceivedInPercent")); 1883 "WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
1879 EXPECT_GT(test::LastHistogramSample( 1884 EXPECT_GT(test::LastHistogramSample(
1880 "WebRTC.Video.NackPacketsSentPerMinute"), 0); 1885 "WebRTC.Video.NackPacketsSentPerMinute"), 0);
1881 EXPECT_GT(test::LastHistogramSample( 1886 EXPECT_GT(test::LastHistogramSample(
1882 "WebRTC.Video.NackPacketsReceivedPerMinute"), 0); 1887 "WebRTC.Video.NackPacketsReceivedPerMinute"), 0);
1883 } 1888 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 1964
1960 const bool use_rtx_; 1965 const bool use_rtx_;
1961 const bool use_red_; 1966 const bool use_red_;
1962 const bool screenshare_; 1967 const bool screenshare_;
1963 Call* sender_call_; 1968 Call* sender_call_;
1964 Call* receiver_call_; 1969 Call* receiver_call_;
1965 int64_t start_runtime_ms_; 1970 int64_t start_runtime_ms_;
1966 } test(use_rtx, use_red, screenshare); 1971 } test(use_rtx, use_red, screenshare);
1967 1972
1968 test::ClearHistograms(); 1973 test::ClearHistograms();
1969 RunBaseTest(&test, FakeNetworkPipe::Config()); 1974 RunBaseTest(&test);
1970 1975
1971 // Delete the call for Call stats to be reported. 1976 // Delete the call for Call stats to be reported.
1972 sender_call_.reset(); 1977 sender_call_.reset();
1973 receiver_call_.reset(); 1978 receiver_call_.reset();
1974 1979
1975 std::string video_prefix = 1980 std::string video_prefix =
1976 screenshare ? "WebRTC.Video.Screenshare." : "WebRTC.Video."; 1981 screenshare ? "WebRTC.Video.Screenshare." : "WebRTC.Video.";
1977 1982
1978 // Verify that stats have been updated once. 1983 // Verify that stats have been updated once.
1979 EXPECT_EQ( 1984 EXPECT_EQ(
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 } 2186 }
2182 2187
2183 rtc::CriticalSection crit_; 2188 rtc::CriticalSection crit_;
2184 bool enable_rrtr_; 2189 bool enable_rrtr_;
2185 int sent_rtcp_sr_; 2190 int sent_rtcp_sr_;
2186 int sent_rtcp_rr_ GUARDED_BY(&crit_); 2191 int sent_rtcp_rr_ GUARDED_BY(&crit_);
2187 int sent_rtcp_rrtr_ GUARDED_BY(&crit_); 2192 int sent_rtcp_rrtr_ GUARDED_BY(&crit_);
2188 int sent_rtcp_dlrr_; 2193 int sent_rtcp_dlrr_;
2189 } test(enable_rrtr); 2194 } test(enable_rrtr);
2190 2195
2191 RunBaseTest(&test, FakeNetworkPipe::Config()); 2196 RunBaseTest(&test);
2192 } 2197 }
2193 2198
2194 void EndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs, 2199 void EndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
2195 bool send_single_ssrc_first) { 2200 bool send_single_ssrc_first) {
2196 class SendsSetSsrcs : public test::EndToEndTest { 2201 class SendsSetSsrcs : public test::EndToEndTest {
2197 public: 2202 public:
2198 SendsSetSsrcs(const uint32_t* ssrcs, 2203 SendsSetSsrcs(const uint32_t* ssrcs,
2199 size_t num_ssrcs, 2204 size_t num_ssrcs,
2200 bool send_single_ssrc_first) 2205 bool send_single_ssrc_first)
2201 : EndToEndTest(kDefaultTimeoutMs), 2206 : EndToEndTest(kDefaultTimeoutMs),
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 const size_t num_ssrcs_; 2285 const size_t num_ssrcs_;
2281 const bool send_single_ssrc_first_; 2286 const bool send_single_ssrc_first_;
2282 2287
2283 size_t ssrcs_to_observe_; 2288 size_t ssrcs_to_observe_;
2284 bool expect_single_ssrc_; 2289 bool expect_single_ssrc_;
2285 2290
2286 VideoSendStream* send_stream_; 2291 VideoSendStream* send_stream_;
2287 VideoEncoderConfig video_encoder_config_all_streams_; 2292 VideoEncoderConfig video_encoder_config_all_streams_;
2288 } test(kVideoSendSsrcs, num_ssrcs, send_single_ssrc_first); 2293 } test(kVideoSendSsrcs, num_ssrcs, send_single_ssrc_first);
2289 2294
2290 RunBaseTest(&test, FakeNetworkPipe::Config()); 2295 RunBaseTest(&test);
2291 } 2296 }
2292 2297
2293 TEST_F(EndToEndTest, ReportsSetEncoderRates) { 2298 TEST_F(EndToEndTest, ReportsSetEncoderRates) {
2294 class EncoderRateStatsTest : public test::EndToEndTest, 2299 class EncoderRateStatsTest : public test::EndToEndTest,
2295 public test::FakeEncoder { 2300 public test::FakeEncoder {
2296 public: 2301 public:
2297 EncoderRateStatsTest() 2302 EncoderRateStatsTest()
2298 : EndToEndTest(kDefaultTimeoutMs), 2303 : EndToEndTest(kDefaultTimeoutMs),
2299 FakeEncoder(Clock::GetRealTimeClock()), 2304 FakeEncoder(Clock::GetRealTimeClock()),
2300 send_stream_(nullptr), 2305 send_stream_(nullptr),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2341 FAIL() 2346 FAIL()
2342 << "Timed out waiting for stats reporting the currently set bitrate."; 2347 << "Timed out waiting for stats reporting the currently set bitrate.";
2343 } 2348 }
2344 2349
2345 private: 2350 private:
2346 rtc::CriticalSection crit_; 2351 rtc::CriticalSection crit_;
2347 VideoSendStream* send_stream_; 2352 VideoSendStream* send_stream_;
2348 uint32_t bitrate_kbps_ GUARDED_BY(crit_); 2353 uint32_t bitrate_kbps_ GUARDED_BY(crit_);
2349 } test; 2354 } test;
2350 2355
2351 RunBaseTest(&test, FakeNetworkPipe::Config()); 2356 RunBaseTest(&test);
2352 } 2357 }
2353 2358
2354 TEST_F(EndToEndTest, GetStats) { 2359 TEST_F(EndToEndTest, GetStats) {
2355 static const int kStartBitrateBps = 3000000; 2360 static const int kStartBitrateBps = 3000000;
2356 static const int kExpectedRenderDelayMs = 20; 2361 static const int kExpectedRenderDelayMs = 20;
2357 class StatsObserver : public test::EndToEndTest, public I420FrameCallback { 2362 class StatsObserver : public test::EndToEndTest, public I420FrameCallback {
2358 public: 2363 public:
2359 StatsObserver() 2364 StatsObserver()
2360 : EndToEndTest(kLongTimeoutMs), 2365 : EndToEndTest(kLongTimeoutMs),
2361 send_stream_(nullptr), 2366 send_stream_(nullptr),
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 bool AllStatsFilled(const std::map<std::string, bool>& stats_map) { 2526 bool AllStatsFilled(const std::map<std::string, bool>& stats_map) {
2522 for (std::map<std::string, bool>::const_iterator it = stats_map.begin(); 2527 for (std::map<std::string, bool>::const_iterator it = stats_map.begin();
2523 it != stats_map.end(); 2528 it != stats_map.end();
2524 ++it) { 2529 ++it) {
2525 if (!it->second) 2530 if (!it->second)
2526 return false; 2531 return false;
2527 } 2532 }
2528 return true; 2533 return true;
2529 } 2534 }
2530 2535
2536 test::PacketTransport* CreateSendTransport(Call* sender_call) override {
2537 FakeNetworkPipe::Config network_config;
2538 network_config.loss_percent = 5;
2539 return new test::PacketTransport(
2540 sender_call, this, test::PacketTransport::kSender, network_config);
2541 }
2542
2531 Call::Config GetSenderCallConfig() override { 2543 Call::Config GetSenderCallConfig() override {
2532 Call::Config config = EndToEndTest::GetSenderCallConfig(); 2544 Call::Config config = EndToEndTest::GetSenderCallConfig();
2533 config.bitrate_config.start_bitrate_bps = kStartBitrateBps; 2545 config.bitrate_config.start_bitrate_bps = kStartBitrateBps;
2534 return config; 2546 return config;
2535 } 2547 }
2536 2548
2537 void ModifyVideoConfigs( 2549 void ModifyVideoConfigs(
2538 VideoSendStream::Config* send_config, 2550 VideoSendStream::Config* send_config,
2539 std::vector<VideoReceiveStream::Config>* receive_configs, 2551 std::vector<VideoReceiveStream::Config>* receive_configs,
2540 VideoEncoderConfig* encoder_config) override { 2552 VideoEncoderConfig* encoder_config) override {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 VideoSendStream* send_stream_; 2619 VideoSendStream* send_stream_;
2608 std::map<std::string, bool> send_stats_filled_; 2620 std::map<std::string, bool> send_stats_filled_;
2609 2621
2610 std::vector<uint32_t> expected_receive_ssrcs_; 2622 std::vector<uint32_t> expected_receive_ssrcs_;
2611 std::set<uint32_t> expected_send_ssrcs_; 2623 std::set<uint32_t> expected_send_ssrcs_;
2612 std::string expected_cname_; 2624 std::string expected_cname_;
2613 2625
2614 rtc::Event check_stats_event_; 2626 rtc::Event check_stats_event_;
2615 } test; 2627 } test;
2616 2628
2617 FakeNetworkPipe::Config network_config; 2629 RunBaseTest(&test);
2618 network_config.loss_percent = 5;
2619 RunBaseTest(&test, network_config);
2620 } 2630 }
2621 2631
2622 TEST_F(EndToEndTest, ReceiverReferenceTimeReportEnabled) { 2632 TEST_F(EndToEndTest, ReceiverReferenceTimeReportEnabled) {
2623 TestXrReceiverReferenceTimeReport(true); 2633 TestXrReceiverReferenceTimeReport(true);
2624 } 2634 }
2625 2635
2626 TEST_F(EndToEndTest, ReceiverReferenceTimeReportDisabled) { 2636 TEST_F(EndToEndTest, ReceiverReferenceTimeReportDisabled) {
2627 TestXrReceiverReferenceTimeReport(false); 2637 TestXrReceiverReferenceTimeReport(false);
2628 } 2638 }
2629 2639
(...skipping 27 matching lines...) Expand all
2657 2667
2658 void PerformTest() override { 2668 void PerformTest() override {
2659 EXPECT_TRUE(Wait()) 2669 EXPECT_TRUE(Wait())
2660 << "Timed out while verifying number of received RTP packets."; 2670 << "Timed out while verifying number of received RTP packets.";
2661 } 2671 }
2662 2672
2663 VideoReceiveStream* receive_stream_; 2673 VideoReceiveStream* receive_stream_;
2664 uint32_t sent_rtp_; 2674 uint32_t sent_rtp_;
2665 } test; 2675 } test;
2666 2676
2667 RunBaseTest(&test, FakeNetworkPipe::Config()); 2677 RunBaseTest(&test);
2668 } 2678 }
2669 2679
2670 TEST_F(EndToEndTest, SendsSetSsrc) { TestSendsSetSsrcs(1, false); } 2680 TEST_F(EndToEndTest, SendsSetSsrc) { TestSendsSetSsrcs(1, false); }
2671 2681
2672 TEST_F(EndToEndTest, SendsSetSimulcastSsrcs) { 2682 TEST_F(EndToEndTest, SendsSetSimulcastSsrcs) {
2673 TestSendsSetSsrcs(kNumSsrcs, false); 2683 TestSendsSetSsrcs(kNumSsrcs, false);
2674 } 2684 }
2675 2685
2676 TEST_F(EndToEndTest, CanSwitchToUseAllSsrcs) { 2686 TEST_F(EndToEndTest, CanSwitchToUseAllSsrcs) {
2677 TestSendsSetSsrcs(kNumSsrcs, true); 2687 TestSendsSetSsrcs(kNumSsrcs, true);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2738 EXPECT_TRUE(Wait()) 2748 EXPECT_TRUE(Wait())
2739 << "Timed out while waiting for redundant payloads on all SSRCs."; 2749 << "Timed out while waiting for redundant payloads on all SSRCs.";
2740 } 2750 }
2741 2751
2742 private: 2752 private:
2743 size_t ssrcs_to_observe_; 2753 size_t ssrcs_to_observe_;
2744 std::map<uint32_t, bool> observed_redundant_retransmission_; 2754 std::map<uint32_t, bool> observed_redundant_retransmission_;
2745 std::map<uint32_t, bool> registered_rtx_ssrc_; 2755 std::map<uint32_t, bool> registered_rtx_ssrc_;
2746 } test; 2756 } test;
2747 2757
2748 RunBaseTest(&test, FakeNetworkPipe::Config()); 2758 RunBaseTest(&test);
2749 } 2759 }
2750 2760
2751 void EndToEndTest::TestRtpStatePreservation(bool use_rtx) { 2761 void EndToEndTest::TestRtpStatePreservation(bool use_rtx) {
2752 static const uint32_t kMaxSequenceNumberGap = 100; 2762 static const uint32_t kMaxSequenceNumberGap = 100;
2753 static const uint64_t kMaxTimestampGap = kDefaultTimeoutMs * 90; 2763 static const uint64_t kMaxTimestampGap = kDefaultTimeoutMs * 90;
2754 class RtpSequenceObserver : public test::RtpRtcpObserver { 2764 class RtpSequenceObserver : public test::RtpRtcpObserver {
2755 public: 2765 public:
2756 explicit RtpSequenceObserver(bool use_rtx) 2766 explicit RtpSequenceObserver(bool use_rtx)
2757 : test::RtpRtcpObserver(kDefaultTimeoutMs), 2767 : test::RtpRtcpObserver(kDefaultTimeoutMs),
2758 ssrcs_to_observe_(kNumSsrcs) { 2768 ssrcs_to_observe_(kNumSsrcs) {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 rtc::Event packet_event_; 3113 rtc::Event packet_event_;
3104 Call* sender_call_; 3114 Call* sender_call_;
3105 Call* receiver_call_; 3115 Call* receiver_call_;
3106 NetworkState sender_state_ GUARDED_BY(test_crit_); 3116 NetworkState sender_state_ GUARDED_BY(test_crit_);
3107 int sender_rtp_ GUARDED_BY(test_crit_); 3117 int sender_rtp_ GUARDED_BY(test_crit_);
3108 int sender_rtcp_ GUARDED_BY(test_crit_); 3118 int sender_rtcp_ GUARDED_BY(test_crit_);
3109 int receiver_rtcp_ GUARDED_BY(test_crit_); 3119 int receiver_rtcp_ GUARDED_BY(test_crit_);
3110 int down_frames_ GUARDED_BY(test_crit_); 3120 int down_frames_ GUARDED_BY(test_crit_);
3111 } test; 3121 } test;
3112 3122
3113 RunBaseTest(&test, FakeNetworkPipe::Config()); 3123 RunBaseTest(&test);
3114 } 3124 }
3115 3125
3116 TEST_F(EndToEndTest, CallReportsRttForSender) { 3126 TEST_F(EndToEndTest, CallReportsRttForSender) {
3117 static const int kSendDelayMs = 30; 3127 static const int kSendDelayMs = 30;
3118 static const int kReceiveDelayMs = 70; 3128 static const int kReceiveDelayMs = 70;
3119 3129
3120 CreateCalls(Call::Config(), Call::Config()); 3130 CreateCalls(Call::Config(), Call::Config());
3121 3131
3122 FakeNetworkPipe::Config config; 3132 FakeNetworkPipe::Config config;
3123 config.queue_delay_ms = kSendDelayMs; 3133 config.queue_delay_ms = kSendDelayMs;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 "packets with transport sequence number."; 3320 "packets with transport sequence number.";
3311 } 3321 }
3312 3322
3313 private: 3323 private:
3314 bool video_observed_; 3324 bool video_observed_;
3315 bool audio_observed_; 3325 bool audio_observed_;
3316 SequenceNumberUnwrapper unwrapper_; 3326 SequenceNumberUnwrapper unwrapper_;
3317 std::set<int64_t> received_packet_ids_; 3327 std::set<int64_t> received_packet_ids_;
3318 } test; 3328 } test;
3319 3329
3320 RunBaseTest(&test, FakeNetworkPipe::Config()); 3330 RunBaseTest(&test);
3321 } 3331 }
3322 } // namespace webrtc 3332 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/call_test.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698