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

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

Issue 3012853002: Update thread annotiation macros to use RTC_ prefix (Closed)
Patch Set: Rebase Created 3 years, 3 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/video/encoder_rtcp_feedback.h ('k') | webrtc/video/overuse_frame_detector.h » ('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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 EXPECT_TRUE(Wait()) 533 EXPECT_TRUE(Wait())
534 << "Timed out waiting for packets to be NACKed, retransmitted and " 534 << "Timed out waiting for packets to be NACKed, retransmitted and "
535 "rendered."; 535 "rendered.";
536 } 536 }
537 537
538 rtc::CriticalSection crit_; 538 rtc::CriticalSection crit_;
539 std::set<uint16_t> dropped_packets_; 539 std::set<uint16_t> dropped_packets_;
540 std::set<uint16_t> retransmitted_packets_; 540 std::set<uint16_t> retransmitted_packets_;
541 uint64_t sent_rtp_packets_; 541 uint64_t sent_rtp_packets_;
542 int packets_left_to_drop_; 542 int packets_left_to_drop_;
543 int nacks_left_ GUARDED_BY(&crit_); 543 int nacks_left_ RTC_GUARDED_BY(&crit_);
544 } test; 544 } test;
545 545
546 RunBaseTest(&test); 546 RunBaseTest(&test);
547 } 547 }
548 548
549 TEST_F(EndToEndTest, ReceivesNackAndRetransmitsAudio) { 549 TEST_F(EndToEndTest, ReceivesNackAndRetransmitsAudio) {
550 class NackObserver : public test::EndToEndTest { 550 class NackObserver : public test::EndToEndTest {
551 public: 551 public:
552 NackObserver() 552 NackObserver()
553 : EndToEndTest(kLongTimeoutMs), 553 : EndToEndTest(kLongTimeoutMs),
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 } 703 }
704 704
705 void PerformTest() override { 705 void PerformTest() override {
706 EXPECT_TRUE(Wait()) 706 EXPECT_TRUE(Wait())
707 << "Timed out waiting for dropped frames to be rendered."; 707 << "Timed out waiting for dropped frames to be rendered.";
708 } 708 }
709 709
710 rtc::CriticalSection crit_; 710 rtc::CriticalSection crit_;
711 std::unique_ptr<VideoEncoder> encoder_; 711 std::unique_ptr<VideoEncoder> encoder_;
712 std::unique_ptr<VideoDecoder> decoder_; 712 std::unique_ptr<VideoDecoder> decoder_;
713 std::set<uint32_t> dropped_sequence_numbers_ GUARDED_BY(crit_); 713 std::set<uint32_t> dropped_sequence_numbers_ RTC_GUARDED_BY(crit_);
714 // Several packets can have the same timestamp. 714 // Several packets can have the same timestamp.
715 std::multiset<uint32_t> dropped_timestamps_ GUARDED_BY(crit_); 715 std::multiset<uint32_t> dropped_timestamps_ RTC_GUARDED_BY(crit_);
716 Random random_; 716 Random random_;
717 int num_packets_sent_ GUARDED_BY(crit_); 717 int num_packets_sent_ RTC_GUARDED_BY(crit_);
718 } test; 718 } test;
719 719
720 RunBaseTest(&test); 720 RunBaseTest(&test);
721 } 721 }
722 722
723 class FlexfecRenderObserver : public test::EndToEndTest, 723 class FlexfecRenderObserver : public test::EndToEndTest,
724 public rtc::VideoSinkInterface<VideoFrame> { 724 public rtc::VideoSinkInterface<VideoFrame> {
725 public: 725 public:
726 static constexpr uint32_t kVideoLocalSsrc = 123; 726 static constexpr uint32_t kVideoLocalSsrc = 123;
727 static constexpr uint32_t kFlexfecLocalSsrc = 456; 727 static constexpr uint32_t kFlexfecLocalSsrc = 456;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 std::vector<FlexfecReceiveStream::Config>* receive_configs) override { 880 std::vector<FlexfecReceiveStream::Config>* receive_configs) override {
881 (*receive_configs)[0].local_ssrc = kFlexfecLocalSsrc; 881 (*receive_configs)[0].local_ssrc = kFlexfecLocalSsrc;
882 } 882 }
883 883
884 void PerformTest() override { 884 void PerformTest() override {
885 EXPECT_TRUE(Wait()) 885 EXPECT_TRUE(Wait())
886 << "Timed out waiting for dropped frames to be rendered."; 886 << "Timed out waiting for dropped frames to be rendered.";
887 } 887 }
888 888
889 rtc::CriticalSection crit_; 889 rtc::CriticalSection crit_;
890 std::set<uint32_t> dropped_sequence_numbers_ GUARDED_BY(crit_); 890 std::set<uint32_t> dropped_sequence_numbers_ RTC_GUARDED_BY(crit_);
891 // Several packets can have the same timestamp. 891 // Several packets can have the same timestamp.
892 std::multiset<uint32_t> dropped_timestamps_ GUARDED_BY(crit_); 892 std::multiset<uint32_t> dropped_timestamps_ RTC_GUARDED_BY(crit_);
893 const bool enable_nack_; 893 const bool enable_nack_;
894 const bool expect_flexfec_rtcp_; 894 const bool expect_flexfec_rtcp_;
895 bool received_flexfec_rtcp_ GUARDED_BY(crit_); 895 bool received_flexfec_rtcp_ RTC_GUARDED_BY(crit_);
896 Random random_; 896 Random random_;
897 int num_packets_sent_; 897 int num_packets_sent_;
898 }; 898 };
899 899
900 TEST_F(EndToEndTest, RecoversWithFlexfec) { 900 TEST_F(EndToEndTest, RecoversWithFlexfec) {
901 FlexfecRenderObserver test(false, false); 901 FlexfecRenderObserver test(false, false);
902 RunBaseTest(&test); 902 RunBaseTest(&test);
903 } 903 }
904 904
905 TEST_F(EndToEndTest, RecoversWithFlexfecAndNack) { 905 TEST_F(EndToEndTest, RecoversWithFlexfecAndNack) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 enum { 1062 enum {
1063 kFirstPacket, 1063 kFirstPacket,
1064 kDropEveryOtherPacketUntilUlpfec, 1064 kDropEveryOtherPacketUntilUlpfec,
1065 kDropAllMediaPacketsUntilUlpfec, 1065 kDropAllMediaPacketsUntilUlpfec,
1066 kDropOneMediaPacket, 1066 kDropOneMediaPacket,
1067 kPassOneMediaPacket, 1067 kPassOneMediaPacket,
1068 kVerifyUlpfecPacketNotInNackList, 1068 kVerifyUlpfecPacketNotInNackList,
1069 } state_; 1069 } state_;
1070 1070
1071 rtc::CriticalSection crit_; 1071 rtc::CriticalSection crit_;
1072 uint16_t ulpfec_sequence_number_ GUARDED_BY(&crit_); 1072 uint16_t ulpfec_sequence_number_ RTC_GUARDED_BY(&crit_);
1073 bool has_last_sequence_number_; 1073 bool has_last_sequence_number_;
1074 uint16_t last_sequence_number_; 1074 uint16_t last_sequence_number_;
1075 std::unique_ptr<webrtc::VideoEncoder> encoder_; 1075 std::unique_ptr<webrtc::VideoEncoder> encoder_;
1076 std::unique_ptr<webrtc::VideoDecoder> decoder_; 1076 std::unique_ptr<webrtc::VideoDecoder> decoder_;
1077 } test; 1077 } test;
1078 1078
1079 RunBaseTest(&test); 1079 RunBaseTest(&test);
1080 } 1080 }
1081 1081
1082 // This test drops second RTP packet with a marker bit set, makes sure it's 1082 // This test drops second RTP packet with a marker bit set, makes sure it's
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 } 1217 }
1218 1218
1219 rtc::CriticalSection crit_; 1219 rtc::CriticalSection crit_;
1220 rtc::VideoSinkInterface<VideoFrame>* orig_renderer_ = nullptr; 1220 rtc::VideoSinkInterface<VideoFrame>* orig_renderer_ = nullptr;
1221 const int payload_type_; 1221 const int payload_type_;
1222 const uint32_t retransmission_ssrc_; 1222 const uint32_t retransmission_ssrc_;
1223 const int retransmission_payload_type_; 1223 const int retransmission_payload_type_;
1224 std::unique_ptr<VideoEncoder> encoder_; 1224 std::unique_ptr<VideoEncoder> encoder_;
1225 const std::string payload_name_; 1225 const std::string payload_name_;
1226 int marker_bits_observed_; 1226 int marker_bits_observed_;
1227 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); 1227 uint32_t retransmitted_timestamp_ RTC_GUARDED_BY(&crit_);
1228 std::vector<uint32_t> rendered_timestamps_ GUARDED_BY(&crit_); 1228 std::vector<uint32_t> rendered_timestamps_ RTC_GUARDED_BY(&crit_);
1229 } test(enable_rtx, enable_red); 1229 } test(enable_rtx, enable_red);
1230 1230
1231 RunBaseTest(&test); 1231 RunBaseTest(&test);
1232 } 1232 }
1233 1233
1234 TEST_F(EndToEndTest, DecodesRetransmittedFrame) { 1234 TEST_F(EndToEndTest, DecodesRetransmittedFrame) {
1235 DecodesRetransmittedFrame(false, false); 1235 DecodesRetransmittedFrame(false, false);
1236 } 1236 }
1237 1237
1238 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) { 1238 TEST_F(EndToEndTest, DecodesRetransmittedFrameOverRtx) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 1312
1313 void PerformTest() override { 1313 void PerformTest() override {
1314 EXPECT_TRUE(Wait()) << "Timed out waiting for PLI to be " 1314 EXPECT_TRUE(Wait()) << "Timed out waiting for PLI to be "
1315 "received and a frame to be " 1315 "received and a frame to be "
1316 "rendered afterwards."; 1316 "rendered afterwards.";
1317 } 1317 }
1318 1318
1319 rtc::CriticalSection crit_; 1319 rtc::CriticalSection crit_;
1320 int rtp_history_ms_; 1320 int rtp_history_ms_;
1321 bool nack_enabled_; 1321 bool nack_enabled_;
1322 uint32_t highest_dropped_timestamp_ GUARDED_BY(&crit_); 1322 uint32_t highest_dropped_timestamp_ RTC_GUARDED_BY(&crit_);
1323 int frames_to_drop_ GUARDED_BY(&crit_); 1323 int frames_to_drop_ RTC_GUARDED_BY(&crit_);
1324 bool received_pli_ GUARDED_BY(&crit_); 1324 bool received_pli_ RTC_GUARDED_BY(&crit_);
1325 } test(rtp_history_ms); 1325 } test(rtp_history_ms);
1326 1326
1327 RunBaseTest(&test); 1327 RunBaseTest(&test);
1328 } 1328 }
1329 1329
1330 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithNack) { 1330 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithNack) {
1331 ReceivesPliAndRecovers(1000); 1331 ReceivesPliAndRecovers(1000);
1332 } 1332 }
1333 1333
1334 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithoutNack) { 1334 TEST_F(EndToEndTest, ReceivesPliAndRecoversWithoutNack) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 EXPECT_TRUE(Wait()) 1472 EXPECT_TRUE(Wait())
1473 << (rtcp_mode_ == RtcpMode::kCompound 1473 << (rtcp_mode_ == RtcpMode::kCompound
1474 ? "Timed out before observing enough compound packets." 1474 ? "Timed out before observing enough compound packets."
1475 : "Timed out before receiving a non-compound RTCP packet."); 1475 : "Timed out before receiving a non-compound RTCP packet.");
1476 } 1476 }
1477 1477
1478 RtcpMode rtcp_mode_; 1478 RtcpMode rtcp_mode_;
1479 rtc::CriticalSection crit_; 1479 rtc::CriticalSection crit_;
1480 // Must be protected since RTCP can be sent by both the process thread 1480 // Must be protected since RTCP can be sent by both the process thread
1481 // and the pacer thread. 1481 // and the pacer thread.
1482 int sent_rtp_ GUARDED_BY(&crit_); 1482 int sent_rtp_ RTC_GUARDED_BY(&crit_);
1483 int sent_rtcp_ GUARDED_BY(&crit_); 1483 int sent_rtcp_ RTC_GUARDED_BY(&crit_);
1484 } test(rtcp_mode); 1484 } test(rtcp_mode);
1485 1485
1486 RunBaseTest(&test); 1486 RunBaseTest(&test);
1487 } 1487 }
1488 1488
1489 TEST_F(EndToEndTest, UsesRtcpCompoundMode) { 1489 TEST_F(EndToEndTest, UsesRtcpCompoundMode) {
1490 RespectsRtcpMode(RtcpMode::kCompound); 1490 RespectsRtcpMode(RtcpMode::kCompound);
1491 } 1491 }
1492 1492
1493 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) { 1493 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) {
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 EXPECT_GT(padding_sent_, 0); 2068 EXPECT_GT(padding_sent_, 0);
2069 } 2069 }
2070 2070
2071 size_t GetNumVideoStreams() const override { return num_video_streams_; } 2071 size_t GetNumVideoStreams() const override { return num_video_streams_; }
2072 size_t GetNumAudioStreams() const override { return num_audio_streams_; } 2072 size_t GetNumAudioStreams() const override { return num_audio_streams_; }
2073 2073
2074 private: 2074 private:
2075 const size_t num_video_streams_; 2075 const size_t num_video_streams_;
2076 const size_t num_audio_streams_; 2076 const size_t num_audio_streams_;
2077 rtc::CriticalSection crit_; 2077 rtc::CriticalSection crit_;
2078 int media_sent_ GUARDED_BY(crit_); 2078 int media_sent_ RTC_GUARDED_BY(crit_);
2079 int padding_sent_ GUARDED_BY(crit_); 2079 int padding_sent_ RTC_GUARDED_BY(crit_);
2080 } test(1, 0); 2080 } test(1, 0);
2081 RunBaseTest(&test); 2081 RunBaseTest(&test);
2082 } 2082 }
2083 2083
2084 TEST_F(EndToEndTest, ObserversEncodedFrames) { 2084 TEST_F(EndToEndTest, ObserversEncodedFrames) {
2085 class EncodedFrameTestObserver : public EncodedFrameObserver { 2085 class EncodedFrameTestObserver : public EncodedFrameObserver {
2086 public: 2086 public:
2087 EncodedFrameTestObserver() 2087 EncodedFrameTestObserver()
2088 : length_(0), frame_type_(kEmptyFrame), called_(false, false) {} 2088 : length_(0), frame_type_(kEmptyFrame), called_(false, false) {}
2089 virtual ~EncodedFrameTestObserver() {} 2089 virtual ~EncodedFrameTestObserver() {}
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 test::RtcpPacketParser rtcp_parser; 2616 test::RtcpPacketParser rtcp_parser;
2617 rtcp_parser.Parse(packet, length); 2617 rtcp_parser.Parse(packet, length);
2618 const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids(); 2618 const std::vector<uint16_t>& nacks = rtcp_parser.nack()->packet_ids();
2619 if (!nacks.empty() && std::find( 2619 if (!nacks.empty() && std::find(
2620 nacks.begin(), nacks.end(), dropped_rtp_packet_) != nacks.end()) { 2620 nacks.begin(), nacks.end(), dropped_rtp_packet_) != nacks.end()) {
2621 dropped_rtp_packet_requested_ = true; 2621 dropped_rtp_packet_requested_ = true;
2622 } 2622 }
2623 return SEND_PACKET; 2623 return SEND_PACKET;
2624 } 2624 }
2625 2625
2626 void VerifyStats() EXCLUSIVE_LOCKS_REQUIRED(&crit_) { 2626 void VerifyStats() RTC_EXCLUSIVE_LOCKS_REQUIRED(&crit_) {
2627 if (!dropped_rtp_packet_requested_) 2627 if (!dropped_rtp_packet_requested_)
2628 return; 2628 return;
2629 int send_stream_nack_packets = 0; 2629 int send_stream_nack_packets = 0;
2630 int receive_stream_nack_packets = 0; 2630 int receive_stream_nack_packets = 0;
2631 VideoSendStream::Stats stats = send_stream_->GetStats(); 2631 VideoSendStream::Stats stats = send_stream_->GetStats();
2632 for (std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator it = 2632 for (std::map<uint32_t, VideoSendStream::StreamStats>::const_iterator it =
2633 stats.substreams.begin(); it != stats.substreams.end(); ++it) { 2633 stats.substreams.begin(); it != stats.substreams.end(); ++it) {
2634 const VideoSendStream::StreamStats& stream_stats = it->second; 2634 const VideoSendStream::StreamStats& stream_stats = it->second;
2635 send_stream_nack_packets += 2635 send_stream_nack_packets +=
2636 stream_stats.rtcp_packet_type_counts.nack_packets; 2636 stream_stats.rtcp_packet_type_counts.nack_packets;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 receive_streams_ = receive_streams; 2673 receive_streams_ = receive_streams;
2674 } 2674 }
2675 2675
2676 void PerformTest() override { 2676 void PerformTest() override {
2677 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; 2677 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed.";
2678 } 2678 }
2679 2679
2680 test::FakeVideoRenderer fake_renderer_; 2680 test::FakeVideoRenderer fake_renderer_;
2681 rtc::CriticalSection crit_; 2681 rtc::CriticalSection crit_;
2682 uint64_t sent_rtp_packets_; 2682 uint64_t sent_rtp_packets_;
2683 uint16_t dropped_rtp_packet_ GUARDED_BY(&crit_); 2683 uint16_t dropped_rtp_packet_ RTC_GUARDED_BY(&crit_);
2684 bool dropped_rtp_packet_requested_ GUARDED_BY(&crit_); 2684 bool dropped_rtp_packet_requested_ RTC_GUARDED_BY(&crit_);
2685 std::vector<VideoReceiveStream*> receive_streams_; 2685 std::vector<VideoReceiveStream*> receive_streams_;
2686 VideoSendStream* send_stream_; 2686 VideoSendStream* send_stream_;
2687 int64_t start_runtime_ms_; 2687 int64_t start_runtime_ms_;
2688 } test; 2688 } test;
2689 2689
2690 metrics::Reset(); 2690 metrics::Reset();
2691 RunBaseTest(&test); 2691 RunBaseTest(&test);
2692 2692
2693 EXPECT_EQ( 2693 EXPECT_EQ(
2694 1, metrics::NumSamples("WebRTC.Video.UniqueNackRequestsSentInPercent")); 2694 1, metrics::NumSamples("WebRTC.Video.UniqueNackRequestsSentInPercent"));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 } 2796 }
2797 2797
2798 rtc::CriticalSection crit_; 2798 rtc::CriticalSection crit_;
2799 const bool use_rtx_; 2799 const bool use_rtx_;
2800 const bool use_red_; 2800 const bool use_red_;
2801 const bool screenshare_; 2801 const bool screenshare_;
2802 const std::unique_ptr<VideoEncoder> vp8_encoder_; 2802 const std::unique_ptr<VideoEncoder> vp8_encoder_;
2803 Call* sender_call_; 2803 Call* sender_call_;
2804 Call* receiver_call_; 2804 Call* receiver_call_;
2805 int64_t start_runtime_ms_; 2805 int64_t start_runtime_ms_;
2806 int num_frames_received_ GUARDED_BY(&crit_); 2806 int num_frames_received_ RTC_GUARDED_BY(&crit_);
2807 } test(use_rtx, use_red, screenshare); 2807 } test(use_rtx, use_red, screenshare);
2808 2808
2809 metrics::Reset(); 2809 metrics::Reset();
2810 RunBaseTest(&test); 2810 RunBaseTest(&test);
2811 2811
2812 std::string video_prefix = 2812 std::string video_prefix =
2813 screenshare ? "WebRTC.Video.Screenshare." : "WebRTC.Video."; 2813 screenshare ? "WebRTC.Video.Screenshare." : "WebRTC.Video.";
2814 // The content type extension is disabled in non screenshare test, 2814 // The content type extension is disabled in non screenshare test,
2815 // therefore no slicing on simulcast id should be present. 2815 // therefore no slicing on simulcast id should be present.
2816 std::string video_suffix = screenshare ? ".S0" : ""; 2816 std::string video_suffix = screenshare ? ".S0" : "";
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
2966 void PerformTest() override { 2966 void PerformTest() override {
2967 EXPECT_TRUE(Wait()) << "Timed out waiting for enough packets."; 2967 EXPECT_TRUE(Wait()) << "Timed out waiting for enough packets.";
2968 // Reset frame counter so next PerformTest() call will do something. 2968 // Reset frame counter so next PerformTest() call will do something.
2969 { 2969 {
2970 rtc::CritScope lock(&crit_); 2970 rtc::CritScope lock(&crit_);
2971 num_frames_received_ = 0; 2971 num_frames_received_ = 0;
2972 } 2972 }
2973 } 2973 }
2974 2974
2975 rtc::CriticalSection crit_; 2975 rtc::CriticalSection crit_;
2976 int num_frames_received_ GUARDED_BY(&crit_); 2976 int num_frames_received_ RTC_GUARDED_BY(&crit_);
2977 } test; 2977 } test;
2978 2978
2979 metrics::Reset(); 2979 metrics::Reset();
2980 2980
2981 Call::Config send_config(test.GetSenderCallConfig()); 2981 Call::Config send_config(test.GetSenderCallConfig());
2982 Call::Config recv_config(test.GetReceiverCallConfig()); 2982 Call::Config recv_config(test.GetReceiverCallConfig());
2983 VideoEncoderConfig encoder_config_with_screenshare; 2983 VideoEncoderConfig encoder_config_with_screenshare;
2984 2984
2985 task_queue_.SendTask([this, &test, &send_config, 2985 task_queue_.SendTask([this, &test, &send_config,
2986 &recv_config, &encoder_config_with_screenshare]() { 2986 &recv_config, &encoder_config_with_screenshare]() {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 } 3270 }
3271 SleepMs(1); 3271 SleepMs(1);
3272 } 3272 }
3273 FAIL() << "Timed out waiting for stats reporting zero bitrate."; 3273 FAIL() << "Timed out waiting for stats reporting zero bitrate.";
3274 } 3274 }
3275 3275
3276 private: 3276 private:
3277 test::SingleThreadedTaskQueueForTesting* const task_queue_; 3277 test::SingleThreadedTaskQueueForTesting* const task_queue_;
3278 rtc::CriticalSection crit_; 3278 rtc::CriticalSection crit_;
3279 VideoSendStream* send_stream_; 3279 VideoSendStream* send_stream_;
3280 uint32_t bitrate_kbps_ GUARDED_BY(crit_); 3280 uint32_t bitrate_kbps_ RTC_GUARDED_BY(crit_);
3281 } test(&task_queue_); 3281 } test(&task_queue_);
3282 3282
3283 RunBaseTest(&test); 3283 RunBaseTest(&test);
3284 } 3284 }
3285 3285
3286 TEST_F(EndToEndTest, GetStats) { 3286 TEST_F(EndToEndTest, GetStats) {
3287 static const int kStartBitrateBps = 3000000; 3287 static const int kStartBitrateBps = 3000000;
3288 static const int kExpectedRenderDelayMs = 20; 3288 static const int kExpectedRenderDelayMs = 20;
3289 3289
3290 class ReceiveStreamRenderer : public rtc::VideoSinkInterface<VideoFrame> { 3290 class ReceiveStreamRenderer : public rtc::VideoSinkInterface<VideoFrame> {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 EXPECT_TRUE(Wait()) 3755 EXPECT_TRUE(Wait())
3756 << "Timed out while waiting for RTCP SR/RR packets to be sent."; 3756 << "Timed out while waiting for RTCP SR/RR packets to be sent.";
3757 } 3757 }
3758 3758
3759 static const int kNumRtcpReportPacketsToObserve = 5; 3759 static const int kNumRtcpReportPacketsToObserve = 5;
3760 3760
3761 rtc::CriticalSection crit_; 3761 rtc::CriticalSection crit_;
3762 const bool enable_rrtr_; 3762 const bool enable_rrtr_;
3763 const bool enable_target_bitrate_; 3763 const bool enable_target_bitrate_;
3764 int sent_rtcp_sr_; 3764 int sent_rtcp_sr_;
3765 int sent_rtcp_rr_ GUARDED_BY(&crit_); 3765 int sent_rtcp_rr_ RTC_GUARDED_BY(&crit_);
3766 int sent_rtcp_rrtr_ GUARDED_BY(&crit_); 3766 int sent_rtcp_rrtr_ RTC_GUARDED_BY(&crit_);
3767 bool sent_rtcp_target_bitrate_ GUARDED_BY(&crit_); 3767 bool sent_rtcp_target_bitrate_ RTC_GUARDED_BY(&crit_);
3768 int sent_rtcp_dlrr_; 3768 int sent_rtcp_dlrr_;
3769 }; 3769 };
3770 3770
3771 TEST_F(EndToEndTest, TestExtendedReportsWithRrtrWithoutTargetBitrate) { 3771 TEST_F(EndToEndTest, TestExtendedReportsWithRrtrWithoutTargetBitrate) {
3772 RtcpXrObserver test(true, false); 3772 RtcpXrObserver test(true, false);
3773 RunBaseTest(&test); 3773 RunBaseTest(&test);
3774 } 3774 }
3775 3775
3776 TEST_F(EndToEndTest, TestExtendedReportsWithoutRrtrWithoutTargetBitrate) { 3776 TEST_F(EndToEndTest, TestExtendedReportsWithoutRrtrWithoutTargetBitrate) {
3777 RtcpXrObserver test(false, false); 3777 RtcpXrObserver test(false, false);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 void ResetExpectedSsrcs(size_t num_expected_ssrcs) { 3987 void ResetExpectedSsrcs(size_t num_expected_ssrcs) {
3988 rtc::CritScope lock(&crit_); 3988 rtc::CritScope lock(&crit_);
3989 ssrc_observed_.clear(); 3989 ssrc_observed_.clear();
3990 ssrcs_to_observe_ = num_expected_ssrcs; 3990 ssrcs_to_observe_ = num_expected_ssrcs;
3991 } 3991 }
3992 3992
3993 private: 3993 private:
3994 void ValidateTimestampGap(uint32_t ssrc, 3994 void ValidateTimestampGap(uint32_t ssrc,
3995 uint32_t timestamp, 3995 uint32_t timestamp,
3996 bool only_padding) 3996 bool only_padding)
3997 EXCLUSIVE_LOCKS_REQUIRED(crit_) { 3997 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_) {
3998 static const int32_t kMaxTimestampGap = kDefaultTimeoutMs * 90; 3998 static const int32_t kMaxTimestampGap = kDefaultTimeoutMs * 90;
3999 auto timestamp_it = last_observed_timestamp_.find(ssrc); 3999 auto timestamp_it = last_observed_timestamp_.find(ssrc);
4000 if (timestamp_it == last_observed_timestamp_.end()) { 4000 if (timestamp_it == last_observed_timestamp_.end()) {
4001 EXPECT_FALSE(only_padding); 4001 EXPECT_FALSE(only_padding);
4002 last_observed_timestamp_[ssrc] = timestamp; 4002 last_observed_timestamp_[ssrc] = timestamp;
4003 } else { 4003 } else {
4004 // Verify timestamps are reasonably close. 4004 // Verify timestamps are reasonably close.
4005 uint32_t latest_observed = timestamp_it->second; 4005 uint32_t latest_observed = timestamp_it->second;
4006 // Wraparound handling is unnecessary here as long as an int variable 4006 // Wraparound handling is unnecessary here as long as an int variable
4007 // is used to store the result. 4007 // is used to store the result.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 } 4076 }
4077 return SEND_PACKET; 4077 return SEND_PACKET;
4078 } 4078 }
4079 4079
4080 SequenceNumberUnwrapper seq_numbers_unwrapper_; 4080 SequenceNumberUnwrapper seq_numbers_unwrapper_;
4081 std::map<uint32_t, std::list<int64_t>> last_observed_seq_numbers_; 4081 std::map<uint32_t, std::list<int64_t>> last_observed_seq_numbers_;
4082 std::map<uint32_t, uint32_t> last_observed_timestamp_; 4082 std::map<uint32_t, uint32_t> last_observed_timestamp_;
4083 std::map<uint32_t, bool> ssrc_is_rtx_; 4083 std::map<uint32_t, bool> ssrc_is_rtx_;
4084 4084
4085 rtc::CriticalSection crit_; 4085 rtc::CriticalSection crit_;
4086 size_t ssrcs_to_observe_ GUARDED_BY(crit_); 4086 size_t ssrcs_to_observe_ RTC_GUARDED_BY(crit_);
4087 std::map<uint32_t, bool> ssrc_observed_ GUARDED_BY(crit_); 4087 std::map<uint32_t, bool> ssrc_observed_ RTC_GUARDED_BY(crit_);
4088 } observer(use_rtx); 4088 } observer(use_rtx);
4089 4089
4090 std::unique_ptr<test::PacketTransport> send_transport; 4090 std::unique_ptr<test::PacketTransport> send_transport;
4091 std::unique_ptr<test::PacketTransport> receive_transport; 4091 std::unique_ptr<test::PacketTransport> receive_transport;
4092 4092
4093 Call::Config config(event_log_.get()); 4093 Call::Config config(event_log_.get());
4094 VideoEncoderConfig one_stream; 4094 VideoEncoderConfig one_stream;
4095 4095
4096 task_queue_.SendTask([this, &observer, &send_transport, &receive_transport, 4096 task_queue_.SendTask([this, &observer, &send_transport, &receive_transport,
4097 &config, &one_stream, use_rtx]() { 4097 &config, &one_stream, use_rtx]() {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
4269 last_observed_timestamp_.emplace(timestamp); 4269 last_observed_timestamp_.emplace(timestamp);
4270 4270
4271 // Pass test when enough packets have been let through. 4271 // Pass test when enough packets have been let through.
4272 if (num_flexfec_packets_sent_ >= 10) { 4272 if (num_flexfec_packets_sent_ >= 10) {
4273 observation_complete_.Set(); 4273 observation_complete_.Set();
4274 } 4274 }
4275 4275
4276 return SEND_PACKET; 4276 return SEND_PACKET;
4277 } 4277 }
4278 4278
4279 rtc::Optional<uint16_t> last_observed_sequence_number_ GUARDED_BY(crit_); 4279 rtc::Optional<uint16_t> last_observed_sequence_number_
4280 rtc::Optional<uint32_t> last_observed_timestamp_ GUARDED_BY(crit_); 4280 RTC_GUARDED_BY(crit_);
4281 size_t num_flexfec_packets_sent_ GUARDED_BY(crit_); 4281 rtc::Optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
4282 size_t num_flexfec_packets_sent_ RTC_GUARDED_BY(crit_);
4282 rtc::CriticalSection crit_; 4283 rtc::CriticalSection crit_;
4283 } observer; 4284 } observer;
4284 4285
4285 static constexpr int kFrameMaxWidth = 320; 4286 static constexpr int kFrameMaxWidth = 320;
4286 static constexpr int kFrameMaxHeight = 180; 4287 static constexpr int kFrameMaxHeight = 180;
4287 static constexpr int kFrameRate = 15; 4288 static constexpr int kFrameRate = 15;
4288 4289
4289 Call::Config config(event_log_.get()); 4290 Call::Config config(event_log_.get());
4290 4291
4291 std::unique_ptr<test::PacketTransport> send_transport; 4292 std::unique_ptr<test::PacketTransport> send_transport;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4588 } 4589 }
4589 } 4590 }
4590 } 4591 }
4591 4592
4592 test::SingleThreadedTaskQueueForTesting* const task_queue_; 4593 test::SingleThreadedTaskQueueForTesting* const task_queue_;
4593 rtc::CriticalSection test_crit_; 4594 rtc::CriticalSection test_crit_;
4594 rtc::Event encoded_frames_; 4595 rtc::Event encoded_frames_;
4595 rtc::Event packet_event_; 4596 rtc::Event packet_event_;
4596 Call* sender_call_; 4597 Call* sender_call_;
4597 Call* receiver_call_; 4598 Call* receiver_call_;
4598 NetworkState sender_state_ GUARDED_BY(test_crit_); 4599 NetworkState sender_state_ RTC_GUARDED_BY(test_crit_);
4599 int sender_rtp_ GUARDED_BY(test_crit_); 4600 int sender_rtp_ RTC_GUARDED_BY(test_crit_);
4600 int sender_padding_ GUARDED_BY(test_crit_); 4601 int sender_padding_ RTC_GUARDED_BY(test_crit_);
4601 int sender_rtcp_ GUARDED_BY(test_crit_); 4602 int sender_rtcp_ RTC_GUARDED_BY(test_crit_);
4602 int receiver_rtcp_ GUARDED_BY(test_crit_); 4603 int receiver_rtcp_ RTC_GUARDED_BY(test_crit_);
4603 int down_frames_ GUARDED_BY(test_crit_); 4604 int down_frames_ RTC_GUARDED_BY(test_crit_);
4604 } test(&task_queue_); 4605 } test(&task_queue_);
4605 4606
4606 RunBaseTest(&test); 4607 RunBaseTest(&test);
4607 } 4608 }
4608 4609
4609 TEST_F(EndToEndTest, CallReportsRttForSender) { 4610 TEST_F(EndToEndTest, CallReportsRttForSender) {
4610 static const int kSendDelayMs = 30; 4611 static const int kSendDelayMs = 30;
4611 static const int kReceiveDelayMs = 70; 4612 static const int kReceiveDelayMs = 70;
4612 4613
4613 std::unique_ptr<test::DirectTransport> sender_transport; 4614 std::unique_ptr<test::DirectTransport> sender_transport;
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
5009 EXPECT_LT(0u, receive_file.Read(out, 100)); 5010 EXPECT_LT(0u, receive_file.Read(out, 100));
5010 observation_complete_.Set(); 5011 observation_complete_.Set();
5011 } 5012 }
5012 } 5013 }
5013 5014
5014 private: 5015 private:
5015 EndToEndLogTest* const fixture_; 5016 EndToEndLogTest* const fixture_;
5016 std::unique_ptr<VideoEncoder> encoder_; 5017 std::unique_ptr<VideoEncoder> encoder_;
5017 std::unique_ptr<VideoDecoder> decoder_; 5018 std::unique_ptr<VideoDecoder> decoder_;
5018 rtc::CriticalSection crit_; 5019 rtc::CriticalSection crit_;
5019 int recorded_frames_ GUARDED_BY(crit_); 5020 int recorded_frames_ RTC_GUARDED_BY(crit_);
5020 } test(this); 5021 } test(this);
5021 5022
5022 RunBaseTest(&test); 5023 RunBaseTest(&test);
5023 } 5024 }
5024 5025
5025 } // namespace webrtc 5026 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/encoder_rtcp_feedback.h ('k') | webrtc/video/overuse_frame_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698