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

Side by Side Diff: webrtc/pc/channel_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698