OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "webrtc/base/array_view.h" | 13 #include "webrtc/base/array_view.h" |
14 #include "webrtc/base/buffer.h" | 14 #include "webrtc/base/buffer.h" |
15 #include "webrtc/base/fakeclock.h" | 15 #include "webrtc/base/fakeclock.h" |
16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/base/gunit.h" |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 #include "webrtc/base/sslstreamadapter.h" | 18 #include "webrtc/base/sslstreamadapter.h" |
19 #include "webrtc/media/base/fakemediaengine.h" | 19 #include "webrtc/media/base/fakemediaengine.h" |
20 #include "webrtc/media/base/fakertp.h" | 20 #include "webrtc/media/base/fakertp.h" |
21 #include "webrtc/media/base/mediachannel.h" | 21 #include "webrtc/media/base/mediachannel.h" |
22 #include "webrtc/media/base/testutils.h" | 22 #include "webrtc/media/base/testutils.h" |
23 #include "webrtc/p2p/base/faketransportcontroller.h" | 23 #include "webrtc/p2p/base/faketransportcontroller.h" |
24 #include "webrtc/p2p/base/transportchannelimpl.h" | |
25 #include "webrtc/pc/channel.h" | 24 #include "webrtc/pc/channel.h" |
26 | 25 |
27 #define MAYBE_SKIP_TEST(feature) \ | 26 #define MAYBE_SKIP_TEST(feature) \ |
28 if (!(rtc::SSLStreamAdapter::feature())) { \ | 27 if (!(rtc::SSLStreamAdapter::feature())) { \ |
29 LOG(LS_INFO) << "Feature disabled... skipping"; \ | 28 LOG(LS_INFO) << "Feature disabled... skipping"; \ |
30 return; \ | 29 return; \ |
31 } | 30 } |
32 | 31 |
33 using cricket::CA_OFFER; | 32 using cricket::CA_OFFER; |
34 using cricket::CA_PRANSWER; | 33 using cricket::CA_PRANSWER; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return true; | 264 return true; |
266 } | 265 } |
267 | 266 |
268 bool AddStream1(int id) { | 267 bool AddStream1(int id) { |
269 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 268 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
270 } | 269 } |
271 bool RemoveStream1(int id) { | 270 bool RemoveStream1(int id) { |
272 return channel1_->RemoveRecvStream(id); | 271 return channel1_->RemoveRecvStream(id); |
273 } | 272 } |
274 | 273 |
275 std::vector<cricket::TransportChannelImpl*> GetChannels1() { | 274 cricket::FakeTransport* GetTransport1() { |
276 return transport_controller1_->channels_for_testing(); | 275 std::string name = channel1_->content_name(); |
| 276 return network_thread_->Invoke<cricket::FakeTransport*>( |
| 277 RTC_FROM_HERE, |
| 278 [this, name] { return transport_controller1_->GetTransport_n(name); }); |
277 } | 279 } |
278 | 280 cricket::FakeTransport* GetTransport2() { |
279 std::vector<cricket::TransportChannelImpl*> GetChannels2() { | 281 std::string name = channel2_->content_name(); |
280 return transport_controller2_->channels_for_testing(); | 282 return network_thread_->Invoke<cricket::FakeTransport*>( |
281 } | 283 RTC_FROM_HERE, |
282 | 284 [this, name] { return transport_controller2_->GetTransport_n(name); }); |
283 cricket::FakeTransportChannel* GetFakeChannel1(int component) { | |
284 return transport_controller1_->GetFakeTransportChannel_n( | |
285 channel1_->content_name(), component); | |
286 } | |
287 | |
288 cricket::FakeTransportChannel* GetFakeChannel2(int component) { | |
289 return transport_controller2_->GetFakeTransportChannel_n( | |
290 channel2_->content_name(), component); | |
291 } | 285 } |
292 | 286 |
293 void SendRtp1() { | 287 void SendRtp1() { |
294 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 288 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
295 rtc::PacketOptions()); | 289 rtc::PacketOptions()); |
296 } | 290 } |
297 void SendRtp2() { | 291 void SendRtp2() { |
298 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 292 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
299 rtc::PacketOptions()); | 293 rtc::PacketOptions()); |
300 } | 294 } |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 EXPECT_TRUE(SendInitiate()); | 1007 EXPECT_TRUE(SendInitiate()); |
1014 EXPECT_TRUE(SendAccept()); | 1008 EXPECT_TRUE(SendAccept()); |
1015 EXPECT_TRUE(SendTerminate()); | 1009 EXPECT_TRUE(SendTerminate()); |
1016 } | 1010 } |
1017 | 1011 |
1018 // Send voice RTP data to the other side and ensure it gets there. | 1012 // Send voice RTP data to the other side and ensure it gets there. |
1019 void SendRtpToRtp() { | 1013 void SendRtpToRtp() { |
1020 CreateChannels(0, 0); | 1014 CreateChannels(0, 0); |
1021 EXPECT_TRUE(SendInitiate()); | 1015 EXPECT_TRUE(SendInitiate()); |
1022 EXPECT_TRUE(SendAccept()); | 1016 EXPECT_TRUE(SendAccept()); |
1023 EXPECT_EQ(1U, GetChannels1().size()); | 1017 ASSERT_TRUE(GetTransport1()); |
1024 EXPECT_EQ(1U, GetChannels2().size()); | 1018 ASSERT_TRUE(GetTransport2()); |
| 1019 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1020 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1025 SendRtp1(); | 1021 SendRtp1(); |
1026 SendRtp2(); | 1022 SendRtp2(); |
1027 WaitForThreads(); | 1023 WaitForThreads(); |
1028 EXPECT_TRUE(CheckRtp1()); | 1024 EXPECT_TRUE(CheckRtp1()); |
1029 EXPECT_TRUE(CheckRtp2()); | 1025 EXPECT_TRUE(CheckRtp2()); |
1030 EXPECT_TRUE(CheckNoRtp1()); | 1026 EXPECT_TRUE(CheckNoRtp1()); |
1031 EXPECT_TRUE(CheckNoRtp2()); | 1027 EXPECT_TRUE(CheckNoRtp2()); |
1032 } | 1028 } |
1033 | 1029 |
1034 void TestDeinit() { | 1030 void TestDeinit() { |
1035 CreateChannels(RTCP, RTCP); | 1031 CreateChannels(RTCP, RTCP); |
1036 EXPECT_TRUE(SendInitiate()); | 1032 EXPECT_TRUE(SendInitiate()); |
1037 EXPECT_TRUE(SendAccept()); | 1033 EXPECT_TRUE(SendAccept()); |
1038 SendRtp1(); | 1034 SendRtp1(); |
1039 SendRtp2(); | 1035 SendRtp2(); |
1040 SendRtcp1(); | 1036 SendRtcp1(); |
1041 SendRtcp2(); | 1037 SendRtcp2(); |
1042 // Do not wait, destroy channels. | 1038 // Do not wait, destroy channels. |
1043 channel1_.reset(nullptr); | 1039 channel1_.reset(nullptr); |
1044 channel2_.reset(nullptr); | 1040 channel2_.reset(nullptr); |
1045 } | 1041 } |
1046 | 1042 |
1047 // Check that RTCP is not transmitted if both sides don't support RTCP. | 1043 // Check that RTCP is not transmitted if both sides don't support RTCP. |
1048 void SendNoRtcpToNoRtcp() { | 1044 void SendNoRtcpToNoRtcp() { |
1049 CreateChannels(0, 0); | 1045 CreateChannels(0, 0); |
1050 EXPECT_TRUE(SendInitiate()); | 1046 EXPECT_TRUE(SendInitiate()); |
1051 EXPECT_TRUE(SendAccept()); | 1047 EXPECT_TRUE(SendAccept()); |
1052 EXPECT_EQ(1U, GetChannels1().size()); | 1048 ASSERT_TRUE(GetTransport1()); |
1053 EXPECT_EQ(1U, GetChannels2().size()); | 1049 ASSERT_TRUE(GetTransport2()); |
| 1050 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1051 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1054 SendRtcp1(); | 1052 SendRtcp1(); |
1055 SendRtcp2(); | 1053 SendRtcp2(); |
1056 WaitForThreads(); | 1054 WaitForThreads(); |
1057 EXPECT_TRUE(CheckNoRtcp1()); | 1055 EXPECT_TRUE(CheckNoRtcp1()); |
1058 EXPECT_TRUE(CheckNoRtcp2()); | 1056 EXPECT_TRUE(CheckNoRtcp2()); |
1059 } | 1057 } |
1060 | 1058 |
1061 // Check that RTCP is not transmitted if the callee doesn't support RTCP. | 1059 // Check that RTCP is not transmitted if the callee doesn't support RTCP. |
1062 void SendNoRtcpToRtcp() { | 1060 void SendNoRtcpToRtcp() { |
1063 CreateChannels(0, RTCP); | 1061 CreateChannels(0, RTCP); |
1064 EXPECT_TRUE(SendInitiate()); | 1062 EXPECT_TRUE(SendInitiate()); |
1065 EXPECT_TRUE(SendAccept()); | 1063 EXPECT_TRUE(SendAccept()); |
1066 EXPECT_EQ(1U, GetChannels1().size()); | 1064 ASSERT_TRUE(GetTransport1()); |
1067 EXPECT_EQ(2U, GetChannels2().size()); | 1065 ASSERT_TRUE(GetTransport2()); |
| 1066 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1067 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1068 SendRtcp1(); | 1068 SendRtcp1(); |
1069 SendRtcp2(); | 1069 SendRtcp2(); |
1070 WaitForThreads(); | 1070 WaitForThreads(); |
1071 EXPECT_TRUE(CheckNoRtcp1()); | 1071 EXPECT_TRUE(CheckNoRtcp1()); |
1072 EXPECT_TRUE(CheckNoRtcp2()); | 1072 EXPECT_TRUE(CheckNoRtcp2()); |
1073 } | 1073 } |
1074 | 1074 |
1075 // Check that RTCP is not transmitted if the caller doesn't support RTCP. | 1075 // Check that RTCP is not transmitted if the caller doesn't support RTCP. |
1076 void SendRtcpToNoRtcp() { | 1076 void SendRtcpToNoRtcp() { |
1077 CreateChannels(RTCP, 0); | 1077 CreateChannels(RTCP, 0); |
1078 EXPECT_TRUE(SendInitiate()); | 1078 EXPECT_TRUE(SendInitiate()); |
1079 EXPECT_TRUE(SendAccept()); | 1079 EXPECT_TRUE(SendAccept()); |
1080 EXPECT_EQ(2U, GetChannels1().size()); | 1080 ASSERT_TRUE(GetTransport1()); |
1081 EXPECT_EQ(1U, GetChannels2().size()); | 1081 ASSERT_TRUE(GetTransport2()); |
| 1082 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1083 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1082 SendRtcp1(); | 1084 SendRtcp1(); |
1083 SendRtcp2(); | 1085 SendRtcp2(); |
1084 WaitForThreads(); | 1086 WaitForThreads(); |
1085 EXPECT_TRUE(CheckNoRtcp1()); | 1087 EXPECT_TRUE(CheckNoRtcp1()); |
1086 EXPECT_TRUE(CheckNoRtcp2()); | 1088 EXPECT_TRUE(CheckNoRtcp2()); |
1087 } | 1089 } |
1088 | 1090 |
1089 // Check that RTCP is transmitted if both sides support RTCP. | 1091 // Check that RTCP is transmitted if both sides support RTCP. |
1090 void SendRtcpToRtcp() { | 1092 void SendRtcpToRtcp() { |
1091 CreateChannels(RTCP, RTCP); | 1093 CreateChannels(RTCP, RTCP); |
1092 EXPECT_TRUE(SendInitiate()); | 1094 EXPECT_TRUE(SendInitiate()); |
1093 EXPECT_TRUE(SendAccept()); | 1095 EXPECT_TRUE(SendAccept()); |
1094 EXPECT_EQ(2U, GetChannels1().size()); | 1096 ASSERT_TRUE(GetTransport1()); |
1095 EXPECT_EQ(2U, GetChannels2().size()); | 1097 ASSERT_TRUE(GetTransport2()); |
| 1098 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1099 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1096 SendRtcp1(); | 1100 SendRtcp1(); |
1097 SendRtcp2(); | 1101 SendRtcp2(); |
1098 WaitForThreads(); | 1102 WaitForThreads(); |
1099 EXPECT_TRUE(CheckRtcp1()); | 1103 EXPECT_TRUE(CheckRtcp1()); |
1100 EXPECT_TRUE(CheckRtcp2()); | 1104 EXPECT_TRUE(CheckRtcp2()); |
1101 EXPECT_TRUE(CheckNoRtcp1()); | 1105 EXPECT_TRUE(CheckNoRtcp1()); |
1102 EXPECT_TRUE(CheckNoRtcp2()); | 1106 EXPECT_TRUE(CheckNoRtcp2()); |
1103 } | 1107 } |
1104 | 1108 |
1105 // Check that RTCP is transmitted if only the initiator supports mux. | 1109 // Check that RTCP is transmitted if only the initiator supports mux. |
1106 void SendRtcpMuxToRtcp() { | 1110 void SendRtcpMuxToRtcp() { |
1107 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1111 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1108 EXPECT_TRUE(SendInitiate()); | 1112 EXPECT_TRUE(SendInitiate()); |
1109 EXPECT_TRUE(SendAccept()); | 1113 EXPECT_TRUE(SendAccept()); |
1110 EXPECT_EQ(2U, GetChannels1().size()); | 1114 ASSERT_TRUE(GetTransport1()); |
1111 EXPECT_EQ(2U, GetChannels2().size()); | 1115 ASSERT_TRUE(GetTransport2()); |
| 1116 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1117 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1112 SendRtcp1(); | 1118 SendRtcp1(); |
1113 SendRtcp2(); | 1119 SendRtcp2(); |
1114 WaitForThreads(); | 1120 WaitForThreads(); |
1115 EXPECT_TRUE(CheckRtcp1()); | 1121 EXPECT_TRUE(CheckRtcp1()); |
1116 EXPECT_TRUE(CheckRtcp2()); | 1122 EXPECT_TRUE(CheckRtcp2()); |
1117 EXPECT_TRUE(CheckNoRtcp1()); | 1123 EXPECT_TRUE(CheckNoRtcp1()); |
1118 EXPECT_TRUE(CheckNoRtcp2()); | 1124 EXPECT_TRUE(CheckNoRtcp2()); |
1119 } | 1125 } |
1120 | 1126 |
1121 // Check that RTP and RTCP are transmitted ok when both sides support mux. | 1127 // Check that RTP and RTCP are transmitted ok when both sides support mux. |
1122 void SendRtcpMuxToRtcpMux() { | 1128 void SendRtcpMuxToRtcpMux() { |
1123 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1129 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1124 EXPECT_TRUE(SendInitiate()); | 1130 EXPECT_TRUE(SendInitiate()); |
1125 EXPECT_EQ(2U, GetChannels1().size()); | 1131 ASSERT_TRUE(GetTransport1()); |
1126 EXPECT_EQ(1U, GetChannels2().size()); | 1132 ASSERT_TRUE(GetTransport2()); |
| 1133 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1134 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1127 EXPECT_TRUE(SendAccept()); | 1135 EXPECT_TRUE(SendAccept()); |
1128 EXPECT_EQ(1U, GetChannels1().size()); | 1136 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1129 SendRtp1(); | 1137 SendRtp1(); |
1130 SendRtp2(); | 1138 SendRtp2(); |
1131 SendRtcp1(); | 1139 SendRtcp1(); |
1132 SendRtcp2(); | 1140 SendRtcp2(); |
1133 WaitForThreads(); | 1141 WaitForThreads(); |
1134 EXPECT_TRUE(CheckRtp1()); | 1142 EXPECT_TRUE(CheckRtp1()); |
1135 EXPECT_TRUE(CheckRtp2()); | 1143 EXPECT_TRUE(CheckRtp2()); |
1136 EXPECT_TRUE(CheckNoRtp1()); | 1144 EXPECT_TRUE(CheckNoRtp1()); |
1137 EXPECT_TRUE(CheckNoRtp2()); | 1145 EXPECT_TRUE(CheckNoRtp2()); |
1138 EXPECT_TRUE(CheckRtcp1()); | 1146 EXPECT_TRUE(CheckRtcp1()); |
1139 EXPECT_TRUE(CheckRtcp2()); | 1147 EXPECT_TRUE(CheckRtcp2()); |
1140 EXPECT_TRUE(CheckNoRtcp1()); | 1148 EXPECT_TRUE(CheckNoRtcp1()); |
1141 EXPECT_TRUE(CheckNoRtcp2()); | 1149 EXPECT_TRUE(CheckNoRtcp2()); |
1142 } | 1150 } |
1143 | 1151 |
1144 // Check that RTP and RTCP are transmitted ok when both sides | 1152 // Check that RTP and RTCP are transmitted ok when both sides |
1145 // support mux and one the offerer requires mux. | 1153 // support mux and one the offerer requires mux. |
1146 void SendRequireRtcpMuxToRtcpMux() { | 1154 void SendRequireRtcpMuxToRtcpMux() { |
1147 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1155 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1148 channel1_->ActivateRtcpMux(); | 1156 channel1_->ActivateRtcpMux(); |
1149 EXPECT_TRUE(SendInitiate()); | 1157 EXPECT_TRUE(SendInitiate()); |
1150 EXPECT_EQ(1U, GetChannels1().size()); | 1158 ASSERT_TRUE(GetTransport1()); |
1151 EXPECT_EQ(1U, GetChannels2().size()); | 1159 ASSERT_TRUE(GetTransport2()); |
| 1160 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1161 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1152 EXPECT_TRUE(SendAccept()); | 1162 EXPECT_TRUE(SendAccept()); |
1153 SendRtp1(); | 1163 SendRtp1(); |
1154 SendRtp2(); | 1164 SendRtp2(); |
1155 SendRtcp1(); | 1165 SendRtcp1(); |
1156 SendRtcp2(); | 1166 SendRtcp2(); |
1157 WaitForThreads(); | 1167 WaitForThreads(); |
1158 EXPECT_TRUE(CheckRtp1()); | 1168 EXPECT_TRUE(CheckRtp1()); |
1159 EXPECT_TRUE(CheckRtp2()); | 1169 EXPECT_TRUE(CheckRtp2()); |
1160 EXPECT_TRUE(CheckNoRtp1()); | 1170 EXPECT_TRUE(CheckNoRtp1()); |
1161 EXPECT_TRUE(CheckNoRtp2()); | 1171 EXPECT_TRUE(CheckNoRtp2()); |
1162 EXPECT_TRUE(CheckRtcp1()); | 1172 EXPECT_TRUE(CheckRtcp1()); |
1163 EXPECT_TRUE(CheckRtcp2()); | 1173 EXPECT_TRUE(CheckRtcp2()); |
1164 EXPECT_TRUE(CheckNoRtcp1()); | 1174 EXPECT_TRUE(CheckNoRtcp1()); |
1165 EXPECT_TRUE(CheckNoRtcp2()); | 1175 EXPECT_TRUE(CheckNoRtcp2()); |
1166 } | 1176 } |
1167 | 1177 |
1168 // Check that RTP and RTCP are transmitted ok when both sides | 1178 // Check that RTP and RTCP are transmitted ok when both sides |
1169 // support mux and one the answerer requires rtcp mux. | 1179 // support mux and one the answerer requires rtcp mux. |
1170 void SendRtcpMuxToRequireRtcpMux() { | 1180 void SendRtcpMuxToRequireRtcpMux() { |
1171 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1181 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1172 channel2_->ActivateRtcpMux(); | 1182 channel2_->ActivateRtcpMux(); |
1173 EXPECT_TRUE(SendInitiate()); | 1183 EXPECT_TRUE(SendInitiate()); |
1174 EXPECT_EQ(2U, GetChannels1().size()); | 1184 ASSERT_TRUE(GetTransport1()); |
1175 EXPECT_EQ(1U, GetChannels2().size()); | 1185 ASSERT_TRUE(GetTransport2()); |
| 1186 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1187 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1176 EXPECT_TRUE(SendAccept()); | 1188 EXPECT_TRUE(SendAccept()); |
1177 EXPECT_EQ(1U, GetChannels1().size()); | 1189 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1178 SendRtp1(); | 1190 SendRtp1(); |
1179 SendRtp2(); | 1191 SendRtp2(); |
1180 SendRtcp1(); | 1192 SendRtcp1(); |
1181 SendRtcp2(); | 1193 SendRtcp2(); |
1182 WaitForThreads(); | 1194 WaitForThreads(); |
1183 EXPECT_TRUE(CheckRtp1()); | 1195 EXPECT_TRUE(CheckRtp1()); |
1184 EXPECT_TRUE(CheckRtp2()); | 1196 EXPECT_TRUE(CheckRtp2()); |
1185 EXPECT_TRUE(CheckNoRtp1()); | 1197 EXPECT_TRUE(CheckNoRtp1()); |
1186 EXPECT_TRUE(CheckNoRtp2()); | 1198 EXPECT_TRUE(CheckNoRtp2()); |
1187 EXPECT_TRUE(CheckRtcp1()); | 1199 EXPECT_TRUE(CheckRtcp1()); |
1188 EXPECT_TRUE(CheckRtcp2()); | 1200 EXPECT_TRUE(CheckRtcp2()); |
1189 EXPECT_TRUE(CheckNoRtcp1()); | 1201 EXPECT_TRUE(CheckNoRtcp1()); |
1190 EXPECT_TRUE(CheckNoRtcp2()); | 1202 EXPECT_TRUE(CheckNoRtcp2()); |
1191 } | 1203 } |
1192 | 1204 |
1193 // Check that RTP and RTCP are transmitted ok when both sides | 1205 // Check that RTP and RTCP are transmitted ok when both sides |
1194 // require mux. | 1206 // require mux. |
1195 void SendRequireRtcpMuxToRequireRtcpMux() { | 1207 void SendRequireRtcpMuxToRequireRtcpMux() { |
1196 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1208 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1197 channel1_->ActivateRtcpMux(); | 1209 channel1_->ActivateRtcpMux(); |
1198 channel2_->ActivateRtcpMux(); | 1210 channel2_->ActivateRtcpMux(); |
1199 EXPECT_TRUE(SendInitiate()); | 1211 EXPECT_TRUE(SendInitiate()); |
1200 EXPECT_EQ(1U, GetChannels1().size()); | 1212 ASSERT_TRUE(GetTransport1()); |
1201 EXPECT_EQ(1U, GetChannels2().size()); | 1213 ASSERT_TRUE(GetTransport2()); |
| 1214 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1215 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1202 EXPECT_TRUE(SendAccept()); | 1216 EXPECT_TRUE(SendAccept()); |
1203 EXPECT_EQ(1U, GetChannels1().size()); | 1217 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1204 SendRtp1(); | 1218 SendRtp1(); |
1205 SendRtp2(); | 1219 SendRtp2(); |
1206 SendRtcp1(); | 1220 SendRtcp1(); |
1207 SendRtcp2(); | 1221 SendRtcp2(); |
1208 WaitForThreads(); | 1222 WaitForThreads(); |
1209 EXPECT_TRUE(CheckRtp1()); | 1223 EXPECT_TRUE(CheckRtp1()); |
1210 EXPECT_TRUE(CheckRtp2()); | 1224 EXPECT_TRUE(CheckRtp2()); |
1211 EXPECT_TRUE(CheckNoRtp1()); | 1225 EXPECT_TRUE(CheckNoRtp1()); |
1212 EXPECT_TRUE(CheckNoRtp2()); | 1226 EXPECT_TRUE(CheckNoRtp2()); |
1213 EXPECT_TRUE(CheckRtcp1()); | 1227 EXPECT_TRUE(CheckRtcp1()); |
1214 EXPECT_TRUE(CheckRtcp2()); | 1228 EXPECT_TRUE(CheckRtcp2()); |
1215 EXPECT_TRUE(CheckNoRtcp1()); | 1229 EXPECT_TRUE(CheckNoRtcp1()); |
1216 EXPECT_TRUE(CheckNoRtcp2()); | 1230 EXPECT_TRUE(CheckNoRtcp2()); |
1217 } | 1231 } |
1218 | 1232 |
1219 // Check that SendAccept fails if the answerer doesn't support mux | 1233 // Check that SendAccept fails if the answerer doesn't support mux |
1220 // and the offerer requires it. | 1234 // and the offerer requires it. |
1221 void SendRequireRtcpMuxToNoRtcpMux() { | 1235 void SendRequireRtcpMuxToNoRtcpMux() { |
1222 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1236 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1223 channel1_->ActivateRtcpMux(); | 1237 channel1_->ActivateRtcpMux(); |
1224 EXPECT_TRUE(SendInitiate()); | 1238 EXPECT_TRUE(SendInitiate()); |
1225 EXPECT_EQ(1U, GetChannels1().size()); | 1239 ASSERT_TRUE(GetTransport1()); |
1226 EXPECT_EQ(2U, GetChannels2().size()); | 1240 ASSERT_TRUE(GetTransport2()); |
| 1241 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1242 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1227 EXPECT_FALSE(SendAccept()); | 1243 EXPECT_FALSE(SendAccept()); |
1228 } | 1244 } |
1229 | 1245 |
1230 // Check that RTCP data sent by the initiator before the accept is not muxed. | 1246 // Check that RTCP data sent by the initiator before the accept is not muxed. |
1231 void SendEarlyRtcpMuxToRtcp() { | 1247 void SendEarlyRtcpMuxToRtcp() { |
1232 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1248 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1233 EXPECT_TRUE(SendInitiate()); | 1249 EXPECT_TRUE(SendInitiate()); |
1234 EXPECT_EQ(2U, GetChannels1().size()); | 1250 ASSERT_TRUE(GetTransport1()); |
1235 EXPECT_EQ(2U, GetChannels2().size()); | 1251 ASSERT_TRUE(GetTransport2()); |
| 1252 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1253 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1236 | 1254 |
1237 // RTCP can be sent before the call is accepted, if the transport is ready. | 1255 // RTCP can be sent before the call is accepted, if the transport is ready. |
1238 // It should not be muxed though, as the remote side doesn't support mux. | 1256 // It should not be muxed though, as the remote side doesn't support mux. |
1239 SendRtcp1(); | 1257 SendRtcp1(); |
1240 WaitForThreads(); | 1258 WaitForThreads(); |
1241 EXPECT_TRUE(CheckNoRtp2()); | 1259 EXPECT_TRUE(CheckNoRtp2()); |
1242 EXPECT_TRUE(CheckRtcp2()); | 1260 EXPECT_TRUE(CheckRtcp2()); |
1243 | 1261 |
1244 // Send RTCP packet from callee and verify that it is received. | 1262 // Send RTCP packet from callee and verify that it is received. |
1245 SendRtcp2(); | 1263 SendRtcp2(); |
1246 WaitForThreads(); | 1264 WaitForThreads(); |
1247 EXPECT_TRUE(CheckNoRtp1()); | 1265 EXPECT_TRUE(CheckNoRtp1()); |
1248 EXPECT_TRUE(CheckRtcp1()); | 1266 EXPECT_TRUE(CheckRtcp1()); |
1249 | 1267 |
1250 // Complete call setup and ensure everything is still OK. | 1268 // Complete call setup and ensure everything is still OK. |
1251 EXPECT_TRUE(SendAccept()); | 1269 EXPECT_TRUE(SendAccept()); |
1252 EXPECT_EQ(2U, GetChannels1().size()); | 1270 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1253 SendRtcp1(); | 1271 SendRtcp1(); |
1254 SendRtcp2(); | 1272 SendRtcp2(); |
1255 WaitForThreads(); | 1273 WaitForThreads(); |
1256 EXPECT_TRUE(CheckRtcp2()); | 1274 EXPECT_TRUE(CheckRtcp2()); |
1257 EXPECT_TRUE(CheckRtcp1()); | 1275 EXPECT_TRUE(CheckRtcp1()); |
1258 } | 1276 } |
1259 | 1277 |
1260 | 1278 |
1261 // Check that RTCP data is not muxed until both sides have enabled muxing, | 1279 // Check that RTCP data is not muxed until both sides have enabled muxing, |
1262 // but that we properly demux before we get the accept message, since there | 1280 // but that we properly demux before we get the accept message, since there |
1263 // is a race between RTP data and the jingle accept. | 1281 // is a race between RTP data and the jingle accept. |
1264 void SendEarlyRtcpMuxToRtcpMux() { | 1282 void SendEarlyRtcpMuxToRtcpMux() { |
1265 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1283 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1266 EXPECT_TRUE(SendInitiate()); | 1284 EXPECT_TRUE(SendInitiate()); |
1267 EXPECT_EQ(2U, GetChannels1().size()); | 1285 ASSERT_TRUE(GetTransport1()); |
1268 EXPECT_EQ(1U, GetChannels2().size()); | 1286 ASSERT_TRUE(GetTransport2()); |
| 1287 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1288 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1269 | 1289 |
1270 // RTCP can't be sent yet, since the RTCP transport isn't writable, and | 1290 // RTCP can't be sent yet, since the RTCP transport isn't writable, and |
1271 // we haven't yet received the accept that says we should mux. | 1291 // we haven't yet received the accept that says we should mux. |
1272 SendRtcp1(); | 1292 SendRtcp1(); |
1273 WaitForThreads(); | 1293 WaitForThreads(); |
1274 EXPECT_TRUE(CheckNoRtcp2()); | 1294 EXPECT_TRUE(CheckNoRtcp2()); |
1275 | 1295 |
1276 // Send muxed RTCP packet from callee and verify that it is received. | 1296 // Send muxed RTCP packet from callee and verify that it is received. |
1277 SendRtcp2(); | 1297 SendRtcp2(); |
1278 WaitForThreads(); | 1298 WaitForThreads(); |
1279 EXPECT_TRUE(CheckNoRtp1()); | 1299 EXPECT_TRUE(CheckNoRtp1()); |
1280 EXPECT_TRUE(CheckRtcp1()); | 1300 EXPECT_TRUE(CheckRtcp1()); |
1281 | 1301 |
1282 // Complete call setup and ensure everything is still OK. | 1302 // Complete call setup and ensure everything is still OK. |
1283 EXPECT_TRUE(SendAccept()); | 1303 EXPECT_TRUE(SendAccept()); |
1284 EXPECT_EQ(1U, GetChannels1().size()); | 1304 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1285 SendRtcp1(); | 1305 SendRtcp1(); |
1286 SendRtcp2(); | 1306 SendRtcp2(); |
1287 WaitForThreads(); | 1307 WaitForThreads(); |
1288 EXPECT_TRUE(CheckRtcp2()); | 1308 EXPECT_TRUE(CheckRtcp2()); |
1289 EXPECT_TRUE(CheckRtcp1()); | 1309 EXPECT_TRUE(CheckRtcp1()); |
1290 } | 1310 } |
1291 | 1311 |
1292 // Test that we properly send SRTP with RTCP in both directions. | 1312 // Test that we properly send SRTP with RTCP in both directions. |
1293 // You can pass in DTLS and/or RTCP_MUX as flags. | 1313 // You can pass in DTLS and/or RTCP_MUX as flags. |
1294 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1314 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. | 1382 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. |
1363 void SendEarlyMediaUsingRtcpMuxSrtp() { | 1383 void SendEarlyMediaUsingRtcpMuxSrtp() { |
1364 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1384 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
1365 | 1385 |
1366 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, | 1386 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, |
1367 SSRC_MUX | RTCP | RTCP_MUX | SECURE); | 1387 SSRC_MUX | RTCP | RTCP_MUX | SECURE); |
1368 EXPECT_TRUE(SendOffer()); | 1388 EXPECT_TRUE(SendOffer()); |
1369 EXPECT_TRUE(SendProvisionalAnswer()); | 1389 EXPECT_TRUE(SendProvisionalAnswer()); |
1370 EXPECT_TRUE(channel1_->secure()); | 1390 EXPECT_TRUE(channel1_->secure()); |
1371 EXPECT_TRUE(channel2_->secure()); | 1391 EXPECT_TRUE(channel2_->secure()); |
1372 EXPECT_EQ(2U, GetChannels1().size()); | 1392 ASSERT_TRUE(GetTransport1()); |
1373 EXPECT_EQ(2U, GetChannels2().size()); | 1393 ASSERT_TRUE(GetTransport2()); |
| 1394 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1395 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1374 WaitForThreads(); // Wait for 'sending' flag go through network thread. | 1396 WaitForThreads(); // Wait for 'sending' flag go through network thread. |
1375 SendCustomRtcp1(kSsrc1); | 1397 SendCustomRtcp1(kSsrc1); |
1376 SendCustomRtp1(kSsrc1, ++sequence_number1_1); | 1398 SendCustomRtp1(kSsrc1, ++sequence_number1_1); |
1377 WaitForThreads(); | 1399 WaitForThreads(); |
1378 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1400 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
1379 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1401 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
1380 | 1402 |
1381 // Send packets from callee and verify that it is received. | 1403 // Send packets from callee and verify that it is received. |
1382 SendCustomRtcp2(kSsrc2); | 1404 SendCustomRtcp2(kSsrc2); |
1383 SendCustomRtp2(kSsrc2, ++sequence_number2_2); | 1405 SendCustomRtp2(kSsrc2, ++sequence_number2_2); |
1384 WaitForThreads(); | 1406 WaitForThreads(); |
1385 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1407 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
1386 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); | 1408 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); |
1387 | 1409 |
1388 // Complete call setup and ensure everything is still OK. | 1410 // Complete call setup and ensure everything is still OK. |
1389 EXPECT_TRUE(SendFinalAnswer()); | 1411 EXPECT_TRUE(SendFinalAnswer()); |
1390 EXPECT_EQ(1U, GetChannels1().size()); | 1412 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1391 EXPECT_EQ(1U, GetChannels2().size()); | 1413 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1392 EXPECT_TRUE(channel1_->secure()); | 1414 EXPECT_TRUE(channel1_->secure()); |
1393 EXPECT_TRUE(channel2_->secure()); | 1415 EXPECT_TRUE(channel2_->secure()); |
1394 SendCustomRtcp1(kSsrc1); | 1416 SendCustomRtcp1(kSsrc1); |
1395 SendCustomRtp1(kSsrc1, ++sequence_number1_1); | 1417 SendCustomRtp1(kSsrc1, ++sequence_number1_1); |
1396 SendCustomRtcp2(kSsrc2); | 1418 SendCustomRtcp2(kSsrc2); |
1397 SendCustomRtp2(kSsrc2, ++sequence_number2_2); | 1419 SendCustomRtp2(kSsrc2, ++sequence_number2_2); |
1398 WaitForThreads(); | 1420 WaitForThreads(); |
1399 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1421 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
1400 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1422 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
1401 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1423 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 EXPECT_TRUE(CheckNoRtcp1()); | 1469 EXPECT_TRUE(CheckNoRtcp1()); |
1448 EXPECT_TRUE(CheckNoRtcp2()); | 1470 EXPECT_TRUE(CheckNoRtcp2()); |
1449 } | 1471 } |
1450 | 1472 |
1451 // Test that the mediachannel retains its sending state after the transport | 1473 // Test that the mediachannel retains its sending state after the transport |
1452 // becomes non-writable. | 1474 // becomes non-writable. |
1453 void SendWithWritabilityLoss() { | 1475 void SendWithWritabilityLoss() { |
1454 CreateChannels(0, 0); | 1476 CreateChannels(0, 0); |
1455 EXPECT_TRUE(SendInitiate()); | 1477 EXPECT_TRUE(SendInitiate()); |
1456 EXPECT_TRUE(SendAccept()); | 1478 EXPECT_TRUE(SendAccept()); |
1457 EXPECT_EQ(1U, GetChannels1().size()); | 1479 ASSERT_TRUE(GetTransport1()); |
1458 EXPECT_EQ(1U, GetChannels2().size()); | 1480 ASSERT_TRUE(GetTransport2()); |
| 1481 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
| 1482 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1459 SendRtp1(); | 1483 SendRtp1(); |
1460 SendRtp2(); | 1484 SendRtp2(); |
1461 WaitForThreads(); | 1485 WaitForThreads(); |
1462 EXPECT_TRUE(CheckRtp1()); | 1486 EXPECT_TRUE(CheckRtp1()); |
1463 EXPECT_TRUE(CheckRtp2()); | 1487 EXPECT_TRUE(CheckRtp2()); |
1464 EXPECT_TRUE(CheckNoRtp1()); | 1488 EXPECT_TRUE(CheckNoRtp1()); |
1465 EXPECT_TRUE(CheckNoRtp2()); | 1489 EXPECT_TRUE(CheckNoRtp2()); |
1466 | 1490 |
1467 // Lose writability, which should fail. | 1491 // Lose writability, which should fail. |
1468 network_thread_->Invoke<void>( | 1492 network_thread_->Invoke<void>( |
1469 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(false); }); | 1493 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(false); }); |
1470 SendRtp1(); | 1494 SendRtp1(); |
1471 SendRtp2(); | 1495 SendRtp2(); |
1472 WaitForThreads(); | 1496 WaitForThreads(); |
1473 EXPECT_TRUE(CheckRtp1()); | 1497 EXPECT_TRUE(CheckRtp1()); |
1474 EXPECT_TRUE(CheckNoRtp2()); | 1498 EXPECT_TRUE(CheckNoRtp2()); |
1475 | 1499 |
1476 // Regain writability | 1500 // Regain writability |
1477 network_thread_->Invoke<void>( | 1501 network_thread_->Invoke<void>( |
1478 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(true); }); | 1502 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(true); }); |
1479 EXPECT_TRUE(media_channel1_->sending()); | 1503 EXPECT_TRUE(media_channel1_->sending()); |
1480 SendRtp1(); | 1504 SendRtp1(); |
1481 SendRtp2(); | 1505 SendRtp2(); |
1482 WaitForThreads(); | 1506 WaitForThreads(); |
1483 EXPECT_TRUE(CheckRtp1()); | 1507 EXPECT_TRUE(CheckRtp1()); |
1484 EXPECT_TRUE(CheckRtp2()); | 1508 EXPECT_TRUE(CheckRtp2()); |
1485 EXPECT_TRUE(CheckNoRtp1()); | 1509 EXPECT_TRUE(CheckNoRtp1()); |
1486 EXPECT_TRUE(CheckNoRtp2()); | 1510 EXPECT_TRUE(CheckNoRtp2()); |
1487 | 1511 |
1488 // Lose writability completely | 1512 // Lose writability completely |
1489 network_thread_->Invoke<void>( | 1513 network_thread_->Invoke<void>( |
1490 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetDestination(nullptr); }); | 1514 RTC_FROM_HERE, [this] { GetTransport1()->SetDestination(NULL); }); |
1491 EXPECT_TRUE(media_channel1_->sending()); | 1515 EXPECT_TRUE(media_channel1_->sending()); |
1492 | 1516 |
1493 // Should fail also. | 1517 // Should fail also. |
1494 SendRtp1(); | 1518 SendRtp1(); |
1495 SendRtp2(); | 1519 SendRtp2(); |
1496 WaitForThreads(); | 1520 WaitForThreads(); |
1497 EXPECT_TRUE(CheckRtp1()); | 1521 EXPECT_TRUE(CheckRtp1()); |
1498 EXPECT_TRUE(CheckNoRtp2()); | 1522 EXPECT_TRUE(CheckNoRtp2()); |
1499 | 1523 |
1500 // Gain writability back | 1524 // Gain writability back |
1501 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1525 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1502 GetFakeChannel1(1)->SetDestination(GetFakeChannel2(1)); | 1526 GetTransport1()->SetDestination(GetTransport2()); |
1503 }); | 1527 }); |
1504 EXPECT_TRUE(media_channel1_->sending()); | 1528 EXPECT_TRUE(media_channel1_->sending()); |
1505 SendRtp1(); | 1529 SendRtp1(); |
1506 SendRtp2(); | 1530 SendRtp2(); |
1507 WaitForThreads(); | 1531 WaitForThreads(); |
1508 EXPECT_TRUE(CheckRtp1()); | 1532 EXPECT_TRUE(CheckRtp1()); |
1509 EXPECT_TRUE(CheckRtp2()); | 1533 EXPECT_TRUE(CheckRtp2()); |
1510 EXPECT_TRUE(CheckNoRtp1()); | 1534 EXPECT_TRUE(CheckNoRtp1()); |
1511 EXPECT_TRUE(CheckNoRtp2()); | 1535 EXPECT_TRUE(CheckNoRtp2()); |
1512 } | 1536 } |
1513 | 1537 |
1514 void SendBundleToBundle( | 1538 void SendBundleToBundle( |
1515 const int* pl_types, int len, bool rtcp_mux, bool secure) { | 1539 const int* pl_types, int len, bool rtcp_mux, bool secure) { |
1516 ASSERT_EQ(2, len); | 1540 ASSERT_EQ(2, len); |
1517 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1541 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
1518 // Only pl_type1 was added to the bundle filter for both |channel1_| | 1542 // Only pl_type1 was added to the bundle filter for both |channel1_| |
1519 // and |channel2_|. | 1543 // and |channel2_|. |
1520 int pl_type1 = pl_types[0]; | 1544 int pl_type1 = pl_types[0]; |
1521 int pl_type2 = pl_types[1]; | 1545 int pl_type2 = pl_types[1]; |
1522 int flags = SSRC_MUX | RTCP; | 1546 int flags = SSRC_MUX | RTCP; |
1523 if (secure) flags |= SECURE; | 1547 if (secure) flags |= SECURE; |
1524 uint32_t expected_channels = 2U; | 1548 uint32_t expected_channels = 2U; |
1525 if (rtcp_mux) { | 1549 if (rtcp_mux) { |
1526 flags |= RTCP_MUX; | 1550 flags |= RTCP_MUX; |
1527 expected_channels = 1U; | 1551 expected_channels = 1U; |
1528 } | 1552 } |
1529 CreateChannels(flags, flags); | 1553 CreateChannels(flags, flags); |
1530 EXPECT_TRUE(SendInitiate()); | 1554 EXPECT_TRUE(SendInitiate()); |
1531 EXPECT_EQ(2U, GetChannels1().size()); | 1555 ASSERT_TRUE(GetTransport1()); |
1532 EXPECT_EQ(expected_channels, GetChannels2().size()); | 1556 ASSERT_TRUE(GetTransport2()); |
| 1557 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1558 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1533 EXPECT_TRUE(SendAccept()); | 1559 EXPECT_TRUE(SendAccept()); |
1534 EXPECT_EQ(expected_channels, GetChannels1().size()); | 1560 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); |
1535 EXPECT_EQ(expected_channels, GetChannels2().size()); | 1561 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1536 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); | 1562 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); |
1537 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); | 1563 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); |
1538 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); | 1564 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); |
1539 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); | 1565 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); |
1540 | 1566 |
1541 // Both channels can receive pl_type1 only. | 1567 // Both channels can receive pl_type1 only. |
1542 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1); | 1568 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1); |
1543 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1); | 1569 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1); |
1544 WaitForThreads(); | 1570 WaitForThreads(); |
1545 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1)); | 1571 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1)); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 sdesc3.get(), cricket::CA_ANSWER, &err)); | 1731 sdesc3.get(), cricket::CA_ANSWER, &err)); |
1706 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1732 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
1707 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); | 1733 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); |
1708 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); | 1734 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); |
1709 } | 1735 } |
1710 | 1736 |
1711 void TestFlushRtcp() { | 1737 void TestFlushRtcp() { |
1712 CreateChannels(RTCP, RTCP); | 1738 CreateChannels(RTCP, RTCP); |
1713 EXPECT_TRUE(SendInitiate()); | 1739 EXPECT_TRUE(SendInitiate()); |
1714 EXPECT_TRUE(SendAccept()); | 1740 EXPECT_TRUE(SendAccept()); |
1715 EXPECT_EQ(2U, GetChannels1().size()); | 1741 ASSERT_TRUE(GetTransport1()); |
1716 EXPECT_EQ(2U, GetChannels2().size()); | 1742 ASSERT_TRUE(GetTransport2()); |
| 1743 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
| 1744 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1717 | 1745 |
1718 // Send RTCP1 from a different thread. | 1746 // Send RTCP1 from a different thread. |
1719 ScopedCallThread send_rtcp([this] { SendRtcp1(); }); | 1747 ScopedCallThread send_rtcp([this] { SendRtcp1(); }); |
1720 // The sending message is only posted. channel2_ should be empty. | 1748 // The sending message is only posted. channel2_ should be empty. |
1721 EXPECT_TRUE(CheckNoRtcp2()); | 1749 EXPECT_TRUE(CheckNoRtcp2()); |
1722 rtc::Thread* wait_for[] = {send_rtcp.thread()}; | 1750 rtc::Thread* wait_for[] = {send_rtcp.thread()}; |
1723 WaitForThreads(wait_for); // Ensure rtcp was posted | 1751 WaitForThreads(wait_for); // Ensure rtcp was posted |
1724 | 1752 |
1725 // When channel1_ is deleted, the RTCP packet should be sent out to | 1753 // When channel1_ is deleted, the RTCP packet should be sent out to |
1726 // channel2_. | 1754 // channel2_. |
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 }; | 3678 }; |
3651 rtc::CopyOnWriteBuffer payload(data, 3); | 3679 rtc::CopyOnWriteBuffer payload(data, 3); |
3652 cricket::SendDataResult result; | 3680 cricket::SendDataResult result; |
3653 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3681 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3654 EXPECT_EQ(params.ssrc, | 3682 EXPECT_EQ(params.ssrc, |
3655 media_channel1_->last_sent_data_params().ssrc); | 3683 media_channel1_->last_sent_data_params().ssrc); |
3656 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3684 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3657 } | 3685 } |
3658 | 3686 |
3659 // TODO(pthatcher): TestSetReceiver? | 3687 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |