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 <algorithm> | 10 #include <algorithm> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 bool SendRtcp(const uint8_t* packet, size_t length) override { | 69 bool SendRtcp(const uint8_t* packet, size_t length) override { |
70 ADD_FAILURE() << "Unexpected RTCP sent."; | 70 ADD_FAILURE() << "Unexpected RTCP sent."; |
71 return false; | 71 return false; |
72 } | 72 } |
73 }; | 73 }; |
74 | 74 |
75 void DecodesRetransmittedFrame(bool use_rtx, bool use_red); | 75 void DecodesRetransmittedFrame(bool use_rtx, bool use_red); |
76 void ReceivesPliAndRecovers(int rtp_history_ms); | 76 void ReceivesPliAndRecovers(int rtp_history_ms); |
77 void RespectsRtcpMode(newapi::RtcpMode rtcp_mode); | 77 void RespectsRtcpMode(RtcpMode rtcp_mode); |
78 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); | 78 void TestXrReceiverReferenceTimeReport(bool enable_rrtr); |
79 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); | 79 void TestSendsSetSsrcs(size_t num_ssrcs, bool send_single_ssrc_first); |
80 void TestRtpStatePreservation(bool use_rtx); | 80 void TestRtpStatePreservation(bool use_rtx); |
81 void TestReceivedFecPacketsNotNacked(const FakeNetworkPipe::Config& config); | 81 void TestReceivedFecPacketsNotNacked(const FakeNetworkPipe::Config& config); |
82 void VerifyHistogramStats(bool use_rtx, bool use_red); | 82 void VerifyHistogramStats(bool use_rtx, bool use_red); |
83 }; | 83 }; |
84 | 84 |
85 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { | 85 TEST_F(EndToEndTest, ReceiverCanBeStartedTwice) { |
86 CreateCalls(Call::Config(), Call::Config()); | 86 CreateCalls(Call::Config(), Call::Config()); |
87 | 87 |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 EXPECT_EQ(kEventSignaled, input_observer.Wait()); | 1047 EXPECT_EQ(kEventSignaled, input_observer.Wait()); |
1048 | 1048 |
1049 Stop(); | 1049 Stop(); |
1050 | 1050 |
1051 DestroyStreams(); | 1051 DestroyStreams(); |
1052 | 1052 |
1053 send_transport.StopSending(); | 1053 send_transport.StopSending(); |
1054 receive_transport.StopSending(); | 1054 receive_transport.StopSending(); |
1055 } | 1055 } |
1056 | 1056 |
1057 void EndToEndTest::RespectsRtcpMode(newapi::RtcpMode rtcp_mode) { | 1057 void EndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) { |
1058 static const int kNumCompoundRtcpPacketsToObserve = 10; | 1058 static const int kNumCompoundRtcpPacketsToObserve = 10; |
1059 class RtcpModeObserver : public test::EndToEndTest { | 1059 class RtcpModeObserver : public test::EndToEndTest { |
1060 public: | 1060 public: |
1061 explicit RtcpModeObserver(newapi::RtcpMode rtcp_mode) | 1061 explicit RtcpModeObserver(RtcpMode rtcp_mode) |
1062 : EndToEndTest(kDefaultTimeoutMs), | 1062 : EndToEndTest(kDefaultTimeoutMs), |
1063 rtcp_mode_(rtcp_mode), | 1063 rtcp_mode_(rtcp_mode), |
1064 sent_rtp_(0), | 1064 sent_rtp_(0), |
1065 sent_rtcp_(0) {} | 1065 sent_rtcp_(0) {} |
1066 | 1066 |
1067 private: | 1067 private: |
1068 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 1068 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
1069 if (++sent_rtp_ % 3 == 0) | 1069 if (++sent_rtp_ % 3 == 0) |
1070 return DROP_PACKET; | 1070 return DROP_PACKET; |
1071 | 1071 |
(...skipping 10 matching lines...) Expand all Loading... |
1082 while (packet_type != RTCPUtility::RTCPPacketTypes::kInvalid) { | 1082 while (packet_type != RTCPUtility::RTCPPacketTypes::kInvalid) { |
1083 EXPECT_NE(RTCPUtility::RTCPPacketTypes::kSr, packet_type); | 1083 EXPECT_NE(RTCPUtility::RTCPPacketTypes::kSr, packet_type); |
1084 if (packet_type == RTCPUtility::RTCPPacketTypes::kRr) { | 1084 if (packet_type == RTCPUtility::RTCPPacketTypes::kRr) { |
1085 has_report_block = true; | 1085 has_report_block = true; |
1086 break; | 1086 break; |
1087 } | 1087 } |
1088 packet_type = parser.Iterate(); | 1088 packet_type = parser.Iterate(); |
1089 } | 1089 } |
1090 | 1090 |
1091 switch (rtcp_mode_) { | 1091 switch (rtcp_mode_) { |
1092 case newapi::kRtcpCompound: | 1092 case RtcpMode::kCompound: |
1093 if (!has_report_block) { | 1093 if (!has_report_block) { |
1094 ADD_FAILURE() << "Received RTCP packet without receiver report for " | 1094 ADD_FAILURE() << "Received RTCP packet without receiver report for " |
1095 "kRtcpCompound."; | 1095 "RtcpMode::kCompound."; |
1096 observation_complete_->Set(); | 1096 observation_complete_->Set(); |
1097 } | 1097 } |
1098 | 1098 |
1099 if (sent_rtcp_ >= kNumCompoundRtcpPacketsToObserve) | 1099 if (sent_rtcp_ >= kNumCompoundRtcpPacketsToObserve) |
1100 observation_complete_->Set(); | 1100 observation_complete_->Set(); |
1101 | 1101 |
1102 break; | 1102 break; |
1103 case newapi::kRtcpReducedSize: | 1103 case RtcpMode::kReducedSize: |
1104 if (!has_report_block) | 1104 if (!has_report_block) |
1105 observation_complete_->Set(); | 1105 observation_complete_->Set(); |
1106 break; | 1106 break; |
| 1107 case RtcpMode::kOff: |
| 1108 RTC_NOTREACHED(); |
| 1109 break; |
1107 } | 1110 } |
1108 | 1111 |
1109 return SEND_PACKET; | 1112 return SEND_PACKET; |
1110 } | 1113 } |
1111 | 1114 |
1112 void ModifyConfigs(VideoSendStream::Config* send_config, | 1115 void ModifyConfigs(VideoSendStream::Config* send_config, |
1113 std::vector<VideoReceiveStream::Config>* receive_configs, | 1116 std::vector<VideoReceiveStream::Config>* receive_configs, |
1114 VideoEncoderConfig* encoder_config) override { | 1117 VideoEncoderConfig* encoder_config) override { |
1115 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1118 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1116 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 1119 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
1117 (*receive_configs)[0].rtp.rtcp_mode = rtcp_mode_; | 1120 (*receive_configs)[0].rtp.rtcp_mode = rtcp_mode_; |
1118 } | 1121 } |
1119 | 1122 |
1120 void PerformTest() override { | 1123 void PerformTest() override { |
1121 EXPECT_EQ(kEventSignaled, Wait()) | 1124 EXPECT_EQ(kEventSignaled, Wait()) |
1122 << (rtcp_mode_ == newapi::kRtcpCompound | 1125 << (rtcp_mode_ == RtcpMode::kCompound |
1123 ? "Timed out before observing enough compound packets." | 1126 ? "Timed out before observing enough compound packets." |
1124 : "Timed out before receiving a non-compound RTCP packet."); | 1127 : "Timed out before receiving a non-compound RTCP packet."); |
1125 } | 1128 } |
1126 | 1129 |
1127 newapi::RtcpMode rtcp_mode_; | 1130 RtcpMode rtcp_mode_; |
1128 int sent_rtp_; | 1131 int sent_rtp_; |
1129 int sent_rtcp_; | 1132 int sent_rtcp_; |
1130 } test(rtcp_mode); | 1133 } test(rtcp_mode); |
1131 | 1134 |
1132 RunBaseTest(&test); | 1135 RunBaseTest(&test); |
1133 } | 1136 } |
1134 | 1137 |
1135 TEST_F(EndToEndTest, UsesRtcpCompoundMode) { | 1138 TEST_F(EndToEndTest, UsesRtcpCompoundMode) { |
1136 RespectsRtcpMode(newapi::kRtcpCompound); | 1139 RespectsRtcpMode(RtcpMode::kCompound); |
1137 } | 1140 } |
1138 | 1141 |
1139 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) { | 1142 TEST_F(EndToEndTest, UsesRtcpReducedSizeMode) { |
1140 RespectsRtcpMode(newapi::kRtcpReducedSize); | 1143 RespectsRtcpMode(RtcpMode::kReducedSize); |
1141 } | 1144 } |
1142 | 1145 |
1143 // Test sets up a Call multiple senders with different resolutions and SSRCs. | 1146 // Test sets up a Call multiple senders with different resolutions and SSRCs. |
1144 // Another is set up to receive all three of these with different renderers. | 1147 // Another is set up to receive all three of these with different renderers. |
1145 class MultiStreamTest { | 1148 class MultiStreamTest { |
1146 public: | 1149 public: |
1147 static const size_t kNumStreams = 3; | 1150 static const size_t kNumStreams = 3; |
1148 struct CodecSettings { | 1151 struct CodecSettings { |
1149 uint32_t ssrc; | 1152 uint32_t ssrc; |
1150 int width; | 1153 int width; |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 EXPECT_EQ(0, sent_rtcp_dlrr_); | 2032 EXPECT_EQ(0, sent_rtcp_dlrr_); |
2030 } | 2033 } |
2031 observation_complete_->Set(); | 2034 observation_complete_->Set(); |
2032 } | 2035 } |
2033 return SEND_PACKET; | 2036 return SEND_PACKET; |
2034 } | 2037 } |
2035 | 2038 |
2036 void ModifyConfigs(VideoSendStream::Config* send_config, | 2039 void ModifyConfigs(VideoSendStream::Config* send_config, |
2037 std::vector<VideoReceiveStream::Config>* receive_configs, | 2040 std::vector<VideoReceiveStream::Config>* receive_configs, |
2038 VideoEncoderConfig* encoder_config) override { | 2041 VideoEncoderConfig* encoder_config) override { |
2039 (*receive_configs)[0].rtp.rtcp_mode = newapi::kRtcpReducedSize; | 2042 (*receive_configs)[0].rtp.rtcp_mode = RtcpMode::kReducedSize; |
2040 (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = | 2043 (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = |
2041 enable_rrtr_; | 2044 enable_rrtr_; |
2042 } | 2045 } |
2043 | 2046 |
2044 void PerformTest() override { | 2047 void PerformTest() override { |
2045 EXPECT_EQ(kEventSignaled, Wait()) | 2048 EXPECT_EQ(kEventSignaled, Wait()) |
2046 << "Timed out while waiting for RTCP SR/RR packets to be sent."; | 2049 << "Timed out while waiting for RTCP SR/RR packets to be sent."; |
2047 } | 2050 } |
2048 | 2051 |
2049 bool enable_rrtr_; | 2052 bool enable_rrtr_; |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3105 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3108 << "Enabling RTX requires rtpmap: rtx negotiation."; |
3106 EXPECT_TRUE(default_send_config.rtp.extensions.empty()) | 3109 EXPECT_TRUE(default_send_config.rtp.extensions.empty()) |
3107 << "Enabling RTP extensions require negotiation."; | 3110 << "Enabling RTP extensions require negotiation."; |
3108 | 3111 |
3109 VerifyEmptyNackConfig(default_send_config.rtp.nack); | 3112 VerifyEmptyNackConfig(default_send_config.rtp.nack); |
3110 VerifyEmptyFecConfig(default_send_config.rtp.fec); | 3113 VerifyEmptyFecConfig(default_send_config.rtp.fec); |
3111 } | 3114 } |
3112 | 3115 |
3113 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { | 3116 TEST_F(EndToEndTest, VerifyDefaultReceiveConfigParameters) { |
3114 VideoReceiveStream::Config default_receive_config(nullptr); | 3117 VideoReceiveStream::Config default_receive_config(nullptr); |
3115 EXPECT_EQ(newapi::kRtcpCompound, default_receive_config.rtp.rtcp_mode) | 3118 EXPECT_EQ(RtcpMode::kCompound, default_receive_config.rtp.rtcp_mode) |
3116 << "Reduced-size RTCP require rtcp-rsize to be negotiated."; | 3119 << "Reduced-size RTCP require rtcp-rsize to be negotiated."; |
3117 EXPECT_FALSE(default_receive_config.rtp.remb) | 3120 EXPECT_FALSE(default_receive_config.rtp.remb) |
3118 << "REMB require rtcp-fb: goog-remb to be negotiated."; | 3121 << "REMB require rtcp-fb: goog-remb to be negotiated."; |
3119 EXPECT_FALSE( | 3122 EXPECT_FALSE( |
3120 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report) | 3123 default_receive_config.rtp.rtcp_xr.receiver_reference_time_report) |
3121 << "RTCP XR settings require rtcp-xr to be negotiated."; | 3124 << "RTCP XR settings require rtcp-xr to be negotiated."; |
3122 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) | 3125 EXPECT_TRUE(default_receive_config.rtp.rtx.empty()) |
3123 << "Enabling RTX requires rtpmap: rtx negotiation."; | 3126 << "Enabling RTX requires rtpmap: rtx negotiation."; |
3124 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) | 3127 EXPECT_TRUE(default_receive_config.rtp.extensions.empty()) |
3125 << "Enabling RTP extensions require negotiation."; | 3128 << "Enabling RTP extensions require negotiation."; |
3126 | 3129 |
3127 VerifyEmptyNackConfig(default_receive_config.rtp.nack); | 3130 VerifyEmptyNackConfig(default_receive_config.rtp.nack); |
3128 VerifyEmptyFecConfig(default_receive_config.rtp.fec); | 3131 VerifyEmptyFecConfig(default_receive_config.rtp.fec); |
3129 } | 3132 } |
3130 | 3133 |
3131 } // namespace webrtc | 3134 } // namespace webrtc |
OLD | NEW |