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

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

Issue 2517883002: Refactoring that removes P2PTransport and DtlsTransport classes. (Closed)
Patch Set: Adding stub transport.h file for backwards compat. 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
« no previous file with comments | « webrtc/p2p/quic/quictransport.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return true; 265 return true;
265 } 266 }
266 267
267 bool AddStream1(int id) { 268 bool AddStream1(int id) {
268 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); 269 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id));
269 } 270 }
270 bool RemoveStream1(int id) { 271 bool RemoveStream1(int id) {
271 return channel1_->RemoveRecvStream(id); 272 return channel1_->RemoveRecvStream(id);
272 } 273 }
273 274
274 cricket::FakeTransport* GetTransport1() { 275 std::vector<cricket::TransportChannelImpl*> GetChannels1() {
275 std::string name = channel1_->content_name(); 276 return transport_controller1_->channels_for_testing();
276 return network_thread_->Invoke<cricket::FakeTransport*>(
277 RTC_FROM_HERE,
278 [this, name] { return transport_controller1_->GetTransport_n(name); });
279 } 277 }
280 cricket::FakeTransport* GetTransport2() { 278
281 std::string name = channel2_->content_name(); 279 std::vector<cricket::TransportChannelImpl*> GetChannels2() {
282 return network_thread_->Invoke<cricket::FakeTransport*>( 280 return transport_controller2_->channels_for_testing();
283 RTC_FROM_HERE, 281 }
284 [this, name] { return transport_controller2_->GetTransport_n(name); }); 282
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);
285 } 291 }
286 292
287 void SendRtp1() { 293 void SendRtp1() {
288 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), 294 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(),
289 rtc::PacketOptions()); 295 rtc::PacketOptions());
290 } 296 }
291 void SendRtp2() { 297 void SendRtp2() {
292 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), 298 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(),
293 rtc::PacketOptions()); 299 rtc::PacketOptions());
294 } 300 }
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 EXPECT_TRUE(SendInitiate()); 1013 EXPECT_TRUE(SendInitiate());
1008 EXPECT_TRUE(SendAccept()); 1014 EXPECT_TRUE(SendAccept());
1009 EXPECT_TRUE(SendTerminate()); 1015 EXPECT_TRUE(SendTerminate());
1010 } 1016 }
1011 1017
1012 // Send voice RTP data to the other side and ensure it gets there. 1018 // Send voice RTP data to the other side and ensure it gets there.
1013 void SendRtpToRtp() { 1019 void SendRtpToRtp() {
1014 CreateChannels(0, 0); 1020 CreateChannels(0, 0);
1015 EXPECT_TRUE(SendInitiate()); 1021 EXPECT_TRUE(SendInitiate());
1016 EXPECT_TRUE(SendAccept()); 1022 EXPECT_TRUE(SendAccept());
1017 ASSERT_TRUE(GetTransport1()); 1023 EXPECT_EQ(1U, GetChannels1().size());
1018 ASSERT_TRUE(GetTransport2()); 1024 EXPECT_EQ(1U, GetChannels2().size());
1019 EXPECT_EQ(1U, GetTransport1()->channels().size());
1020 EXPECT_EQ(1U, GetTransport2()->channels().size());
1021 SendRtp1(); 1025 SendRtp1();
1022 SendRtp2(); 1026 SendRtp2();
1023 WaitForThreads(); 1027 WaitForThreads();
1024 EXPECT_TRUE(CheckRtp1()); 1028 EXPECT_TRUE(CheckRtp1());
1025 EXPECT_TRUE(CheckRtp2()); 1029 EXPECT_TRUE(CheckRtp2());
1026 EXPECT_TRUE(CheckNoRtp1()); 1030 EXPECT_TRUE(CheckNoRtp1());
1027 EXPECT_TRUE(CheckNoRtp2()); 1031 EXPECT_TRUE(CheckNoRtp2());
1028 } 1032 }
1029 1033
1030 void TestDeinit() { 1034 void TestDeinit() {
1031 CreateChannels(RTCP, RTCP); 1035 CreateChannels(RTCP, RTCP);
1032 EXPECT_TRUE(SendInitiate()); 1036 EXPECT_TRUE(SendInitiate());
1033 EXPECT_TRUE(SendAccept()); 1037 EXPECT_TRUE(SendAccept());
1034 SendRtp1(); 1038 SendRtp1();
1035 SendRtp2(); 1039 SendRtp2();
1036 SendRtcp1(); 1040 SendRtcp1();
1037 SendRtcp2(); 1041 SendRtcp2();
1038 // Do not wait, destroy channels. 1042 // Do not wait, destroy channels.
1039 channel1_.reset(nullptr); 1043 channel1_.reset(nullptr);
1040 channel2_.reset(nullptr); 1044 channel2_.reset(nullptr);
1041 } 1045 }
1042 1046
1043 // Check that RTCP is not transmitted if both sides don't support RTCP. 1047 // Check that RTCP is not transmitted if both sides don't support RTCP.
1044 void SendNoRtcpToNoRtcp() { 1048 void SendNoRtcpToNoRtcp() {
1045 CreateChannels(0, 0); 1049 CreateChannels(0, 0);
1046 EXPECT_TRUE(SendInitiate()); 1050 EXPECT_TRUE(SendInitiate());
1047 EXPECT_TRUE(SendAccept()); 1051 EXPECT_TRUE(SendAccept());
1048 ASSERT_TRUE(GetTransport1()); 1052 EXPECT_EQ(1U, GetChannels1().size());
1049 ASSERT_TRUE(GetTransport2()); 1053 EXPECT_EQ(1U, GetChannels2().size());
1050 EXPECT_EQ(1U, GetTransport1()->channels().size());
1051 EXPECT_EQ(1U, GetTransport2()->channels().size());
1052 SendRtcp1(); 1054 SendRtcp1();
1053 SendRtcp2(); 1055 SendRtcp2();
1054 WaitForThreads(); 1056 WaitForThreads();
1055 EXPECT_TRUE(CheckNoRtcp1()); 1057 EXPECT_TRUE(CheckNoRtcp1());
1056 EXPECT_TRUE(CheckNoRtcp2()); 1058 EXPECT_TRUE(CheckNoRtcp2());
1057 } 1059 }
1058 1060
1059 // Check that RTCP is not transmitted if the callee doesn't support RTCP. 1061 // Check that RTCP is not transmitted if the callee doesn't support RTCP.
1060 void SendNoRtcpToRtcp() { 1062 void SendNoRtcpToRtcp() {
1061 CreateChannels(0, RTCP); 1063 CreateChannels(0, RTCP);
1062 EXPECT_TRUE(SendInitiate()); 1064 EXPECT_TRUE(SendInitiate());
1063 EXPECT_TRUE(SendAccept()); 1065 EXPECT_TRUE(SendAccept());
1064 ASSERT_TRUE(GetTransport1()); 1066 EXPECT_EQ(1U, GetChannels1().size());
1065 ASSERT_TRUE(GetTransport2()); 1067 EXPECT_EQ(2U, GetChannels2().size());
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 ASSERT_TRUE(GetTransport1()); 1080 EXPECT_EQ(2U, GetChannels1().size());
1081 ASSERT_TRUE(GetTransport2()); 1081 EXPECT_EQ(1U, GetChannels2().size());
1082 EXPECT_EQ(2U, GetTransport1()->channels().size());
1083 EXPECT_EQ(1U, GetTransport2()->channels().size());
1084 SendRtcp1(); 1082 SendRtcp1();
1085 SendRtcp2(); 1083 SendRtcp2();
1086 WaitForThreads(); 1084 WaitForThreads();
1087 EXPECT_TRUE(CheckNoRtcp1()); 1085 EXPECT_TRUE(CheckNoRtcp1());
1088 EXPECT_TRUE(CheckNoRtcp2()); 1086 EXPECT_TRUE(CheckNoRtcp2());
1089 } 1087 }
1090 1088
1091 // Check that RTCP is transmitted if both sides support RTCP. 1089 // Check that RTCP is transmitted if both sides support RTCP.
1092 void SendRtcpToRtcp() { 1090 void SendRtcpToRtcp() {
1093 CreateChannels(RTCP, RTCP); 1091 CreateChannels(RTCP, RTCP);
1094 EXPECT_TRUE(SendInitiate()); 1092 EXPECT_TRUE(SendInitiate());
1095 EXPECT_TRUE(SendAccept()); 1093 EXPECT_TRUE(SendAccept());
1096 ASSERT_TRUE(GetTransport1()); 1094 EXPECT_EQ(2U, GetChannels1().size());
1097 ASSERT_TRUE(GetTransport2()); 1095 EXPECT_EQ(2U, GetChannels2().size());
1098 EXPECT_EQ(2U, GetTransport1()->channels().size());
1099 EXPECT_EQ(2U, GetTransport2()->channels().size());
1100 SendRtcp1(); 1096 SendRtcp1();
1101 SendRtcp2(); 1097 SendRtcp2();
1102 WaitForThreads(); 1098 WaitForThreads();
1103 EXPECT_TRUE(CheckRtcp1()); 1099 EXPECT_TRUE(CheckRtcp1());
1104 EXPECT_TRUE(CheckRtcp2()); 1100 EXPECT_TRUE(CheckRtcp2());
1105 EXPECT_TRUE(CheckNoRtcp1()); 1101 EXPECT_TRUE(CheckNoRtcp1());
1106 EXPECT_TRUE(CheckNoRtcp2()); 1102 EXPECT_TRUE(CheckNoRtcp2());
1107 } 1103 }
1108 1104
1109 // Check that RTCP is transmitted if only the initiator supports mux. 1105 // Check that RTCP is transmitted if only the initiator supports mux.
1110 void SendRtcpMuxToRtcp() { 1106 void SendRtcpMuxToRtcp() {
1111 CreateChannels(RTCP | RTCP_MUX, RTCP); 1107 CreateChannels(RTCP | RTCP_MUX, RTCP);
1112 EXPECT_TRUE(SendInitiate()); 1108 EXPECT_TRUE(SendInitiate());
1113 EXPECT_TRUE(SendAccept()); 1109 EXPECT_TRUE(SendAccept());
1114 ASSERT_TRUE(GetTransport1()); 1110 EXPECT_EQ(2U, GetChannels1().size());
1115 ASSERT_TRUE(GetTransport2()); 1111 EXPECT_EQ(2U, GetChannels2().size());
1116 EXPECT_EQ(2U, GetTransport1()->channels().size());
1117 EXPECT_EQ(2U, GetTransport2()->channels().size());
1118 SendRtcp1(); 1112 SendRtcp1();
1119 SendRtcp2(); 1113 SendRtcp2();
1120 WaitForThreads(); 1114 WaitForThreads();
1121 EXPECT_TRUE(CheckRtcp1()); 1115 EXPECT_TRUE(CheckRtcp1());
1122 EXPECT_TRUE(CheckRtcp2()); 1116 EXPECT_TRUE(CheckRtcp2());
1123 EXPECT_TRUE(CheckNoRtcp1()); 1117 EXPECT_TRUE(CheckNoRtcp1());
1124 EXPECT_TRUE(CheckNoRtcp2()); 1118 EXPECT_TRUE(CheckNoRtcp2());
1125 } 1119 }
1126 1120
1127 // Check that RTP and RTCP are transmitted ok when both sides support mux. 1121 // Check that RTP and RTCP are transmitted ok when both sides support mux.
1128 void SendRtcpMuxToRtcpMux() { 1122 void SendRtcpMuxToRtcpMux() {
1129 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1123 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1130 EXPECT_TRUE(SendInitiate()); 1124 EXPECT_TRUE(SendInitiate());
1131 ASSERT_TRUE(GetTransport1()); 1125 EXPECT_EQ(2U, GetChannels1().size());
1132 ASSERT_TRUE(GetTransport2()); 1126 EXPECT_EQ(1U, GetChannels2().size());
1133 EXPECT_EQ(2U, GetTransport1()->channels().size());
1134 EXPECT_EQ(1U, GetTransport2()->channels().size());
1135 EXPECT_TRUE(SendAccept()); 1127 EXPECT_TRUE(SendAccept());
1136 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1128 EXPECT_EQ(1U, GetChannels1().size());
1137 SendRtp1(); 1129 SendRtp1();
1138 SendRtp2(); 1130 SendRtp2();
1139 SendRtcp1(); 1131 SendRtcp1();
1140 SendRtcp2(); 1132 SendRtcp2();
1141 WaitForThreads(); 1133 WaitForThreads();
1142 EXPECT_TRUE(CheckRtp1()); 1134 EXPECT_TRUE(CheckRtp1());
1143 EXPECT_TRUE(CheckRtp2()); 1135 EXPECT_TRUE(CheckRtp2());
1144 EXPECT_TRUE(CheckNoRtp1()); 1136 EXPECT_TRUE(CheckNoRtp1());
1145 EXPECT_TRUE(CheckNoRtp2()); 1137 EXPECT_TRUE(CheckNoRtp2());
1146 EXPECT_TRUE(CheckRtcp1()); 1138 EXPECT_TRUE(CheckRtcp1());
1147 EXPECT_TRUE(CheckRtcp2()); 1139 EXPECT_TRUE(CheckRtcp2());
1148 EXPECT_TRUE(CheckNoRtcp1()); 1140 EXPECT_TRUE(CheckNoRtcp1());
1149 EXPECT_TRUE(CheckNoRtcp2()); 1141 EXPECT_TRUE(CheckNoRtcp2());
1150 } 1142 }
1151 1143
1152 // Check that RTP and RTCP are transmitted ok when both sides 1144 // Check that RTP and RTCP are transmitted ok when both sides
1153 // support mux and one the offerer requires mux. 1145 // support mux and one the offerer requires mux.
1154 void SendRequireRtcpMuxToRtcpMux() { 1146 void SendRequireRtcpMuxToRtcpMux() {
1155 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1147 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1156 channel1_->ActivateRtcpMux(); 1148 channel1_->ActivateRtcpMux();
1157 EXPECT_TRUE(SendInitiate()); 1149 EXPECT_TRUE(SendInitiate());
1158 ASSERT_TRUE(GetTransport1()); 1150 EXPECT_EQ(1U, GetChannels1().size());
1159 ASSERT_TRUE(GetTransport2()); 1151 EXPECT_EQ(1U, GetChannels2().size());
1160 EXPECT_EQ(1U, GetTransport1()->channels().size());
1161 EXPECT_EQ(1U, GetTransport2()->channels().size());
1162 EXPECT_TRUE(SendAccept()); 1152 EXPECT_TRUE(SendAccept());
1163 SendRtp1(); 1153 SendRtp1();
1164 SendRtp2(); 1154 SendRtp2();
1165 SendRtcp1(); 1155 SendRtcp1();
1166 SendRtcp2(); 1156 SendRtcp2();
1167 WaitForThreads(); 1157 WaitForThreads();
1168 EXPECT_TRUE(CheckRtp1()); 1158 EXPECT_TRUE(CheckRtp1());
1169 EXPECT_TRUE(CheckRtp2()); 1159 EXPECT_TRUE(CheckRtp2());
1170 EXPECT_TRUE(CheckNoRtp1()); 1160 EXPECT_TRUE(CheckNoRtp1());
1171 EXPECT_TRUE(CheckNoRtp2()); 1161 EXPECT_TRUE(CheckNoRtp2());
1172 EXPECT_TRUE(CheckRtcp1()); 1162 EXPECT_TRUE(CheckRtcp1());
1173 EXPECT_TRUE(CheckRtcp2()); 1163 EXPECT_TRUE(CheckRtcp2());
1174 EXPECT_TRUE(CheckNoRtcp1()); 1164 EXPECT_TRUE(CheckNoRtcp1());
1175 EXPECT_TRUE(CheckNoRtcp2()); 1165 EXPECT_TRUE(CheckNoRtcp2());
1176 } 1166 }
1177 1167
1178 // Check that RTP and RTCP are transmitted ok when both sides 1168 // Check that RTP and RTCP are transmitted ok when both sides
1179 // support mux and one the answerer requires rtcp mux. 1169 // support mux and one the answerer requires rtcp mux.
1180 void SendRtcpMuxToRequireRtcpMux() { 1170 void SendRtcpMuxToRequireRtcpMux() {
1181 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1171 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1182 channel2_->ActivateRtcpMux(); 1172 channel2_->ActivateRtcpMux();
1183 EXPECT_TRUE(SendInitiate()); 1173 EXPECT_TRUE(SendInitiate());
1184 ASSERT_TRUE(GetTransport1()); 1174 EXPECT_EQ(2U, GetChannels1().size());
1185 ASSERT_TRUE(GetTransport2()); 1175 EXPECT_EQ(1U, GetChannels2().size());
1186 EXPECT_EQ(2U, GetTransport1()->channels().size());
1187 EXPECT_EQ(1U, GetTransport2()->channels().size());
1188 EXPECT_TRUE(SendAccept()); 1176 EXPECT_TRUE(SendAccept());
1189 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1177 EXPECT_EQ(1U, GetChannels1().size());
1190 SendRtp1(); 1178 SendRtp1();
1191 SendRtp2(); 1179 SendRtp2();
1192 SendRtcp1(); 1180 SendRtcp1();
1193 SendRtcp2(); 1181 SendRtcp2();
1194 WaitForThreads(); 1182 WaitForThreads();
1195 EXPECT_TRUE(CheckRtp1()); 1183 EXPECT_TRUE(CheckRtp1());
1196 EXPECT_TRUE(CheckRtp2()); 1184 EXPECT_TRUE(CheckRtp2());
1197 EXPECT_TRUE(CheckNoRtp1()); 1185 EXPECT_TRUE(CheckNoRtp1());
1198 EXPECT_TRUE(CheckNoRtp2()); 1186 EXPECT_TRUE(CheckNoRtp2());
1199 EXPECT_TRUE(CheckRtcp1()); 1187 EXPECT_TRUE(CheckRtcp1());
1200 EXPECT_TRUE(CheckRtcp2()); 1188 EXPECT_TRUE(CheckRtcp2());
1201 EXPECT_TRUE(CheckNoRtcp1()); 1189 EXPECT_TRUE(CheckNoRtcp1());
1202 EXPECT_TRUE(CheckNoRtcp2()); 1190 EXPECT_TRUE(CheckNoRtcp2());
1203 } 1191 }
1204 1192
1205 // Check that RTP and RTCP are transmitted ok when both sides 1193 // Check that RTP and RTCP are transmitted ok when both sides
1206 // require mux. 1194 // require mux.
1207 void SendRequireRtcpMuxToRequireRtcpMux() { 1195 void SendRequireRtcpMuxToRequireRtcpMux() {
1208 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1196 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1209 channel1_->ActivateRtcpMux(); 1197 channel1_->ActivateRtcpMux();
1210 channel2_->ActivateRtcpMux(); 1198 channel2_->ActivateRtcpMux();
1211 EXPECT_TRUE(SendInitiate()); 1199 EXPECT_TRUE(SendInitiate());
1212 ASSERT_TRUE(GetTransport1()); 1200 EXPECT_EQ(1U, GetChannels1().size());
1213 ASSERT_TRUE(GetTransport2()); 1201 EXPECT_EQ(1U, GetChannels2().size());
1214 EXPECT_EQ(1U, GetTransport1()->channels().size());
1215 EXPECT_EQ(1U, GetTransport2()->channels().size());
1216 EXPECT_TRUE(SendAccept()); 1202 EXPECT_TRUE(SendAccept());
1217 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1203 EXPECT_EQ(1U, GetChannels1().size());
1218 SendRtp1(); 1204 SendRtp1();
1219 SendRtp2(); 1205 SendRtp2();
1220 SendRtcp1(); 1206 SendRtcp1();
1221 SendRtcp2(); 1207 SendRtcp2();
1222 WaitForThreads(); 1208 WaitForThreads();
1223 EXPECT_TRUE(CheckRtp1()); 1209 EXPECT_TRUE(CheckRtp1());
1224 EXPECT_TRUE(CheckRtp2()); 1210 EXPECT_TRUE(CheckRtp2());
1225 EXPECT_TRUE(CheckNoRtp1()); 1211 EXPECT_TRUE(CheckNoRtp1());
1226 EXPECT_TRUE(CheckNoRtp2()); 1212 EXPECT_TRUE(CheckNoRtp2());
1227 EXPECT_TRUE(CheckRtcp1()); 1213 EXPECT_TRUE(CheckRtcp1());
1228 EXPECT_TRUE(CheckRtcp2()); 1214 EXPECT_TRUE(CheckRtcp2());
1229 EXPECT_TRUE(CheckNoRtcp1()); 1215 EXPECT_TRUE(CheckNoRtcp1());
1230 EXPECT_TRUE(CheckNoRtcp2()); 1216 EXPECT_TRUE(CheckNoRtcp2());
1231 } 1217 }
1232 1218
1233 // Check that SendAccept fails if the answerer doesn't support mux 1219 // Check that SendAccept fails if the answerer doesn't support mux
1234 // and the offerer requires it. 1220 // and the offerer requires it.
1235 void SendRequireRtcpMuxToNoRtcpMux() { 1221 void SendRequireRtcpMuxToNoRtcpMux() {
1236 CreateChannels(RTCP | RTCP_MUX, RTCP); 1222 CreateChannels(RTCP | RTCP_MUX, RTCP);
1237 channel1_->ActivateRtcpMux(); 1223 channel1_->ActivateRtcpMux();
1238 EXPECT_TRUE(SendInitiate()); 1224 EXPECT_TRUE(SendInitiate());
1239 ASSERT_TRUE(GetTransport1()); 1225 EXPECT_EQ(1U, GetChannels1().size());
1240 ASSERT_TRUE(GetTransport2()); 1226 EXPECT_EQ(2U, GetChannels2().size());
1241 EXPECT_EQ(1U, GetTransport1()->channels().size());
1242 EXPECT_EQ(2U, GetTransport2()->channels().size());
1243 EXPECT_FALSE(SendAccept()); 1227 EXPECT_FALSE(SendAccept());
1244 } 1228 }
1245 1229
1246 // Check that RTCP data sent by the initiator before the accept is not muxed. 1230 // Check that RTCP data sent by the initiator before the accept is not muxed.
1247 void SendEarlyRtcpMuxToRtcp() { 1231 void SendEarlyRtcpMuxToRtcp() {
1248 CreateChannels(RTCP | RTCP_MUX, RTCP); 1232 CreateChannels(RTCP | RTCP_MUX, RTCP);
1249 EXPECT_TRUE(SendInitiate()); 1233 EXPECT_TRUE(SendInitiate());
1250 ASSERT_TRUE(GetTransport1()); 1234 EXPECT_EQ(2U, GetChannels1().size());
1251 ASSERT_TRUE(GetTransport2()); 1235 EXPECT_EQ(2U, GetChannels2().size());
1252 EXPECT_EQ(2U, GetTransport1()->channels().size());
1253 EXPECT_EQ(2U, GetTransport2()->channels().size());
1254 1236
1255 // RTCP can be sent before the call is accepted, if the transport is ready. 1237 // RTCP can be sent before the call is accepted, if the transport is ready.
1256 // It should not be muxed though, as the remote side doesn't support mux. 1238 // It should not be muxed though, as the remote side doesn't support mux.
1257 SendRtcp1(); 1239 SendRtcp1();
1258 WaitForThreads(); 1240 WaitForThreads();
1259 EXPECT_TRUE(CheckNoRtp2()); 1241 EXPECT_TRUE(CheckNoRtp2());
1260 EXPECT_TRUE(CheckRtcp2()); 1242 EXPECT_TRUE(CheckRtcp2());
1261 1243
1262 // Send RTCP packet from callee and verify that it is received. 1244 // Send RTCP packet from callee and verify that it is received.
1263 SendRtcp2(); 1245 SendRtcp2();
1264 WaitForThreads(); 1246 WaitForThreads();
1265 EXPECT_TRUE(CheckNoRtp1()); 1247 EXPECT_TRUE(CheckNoRtp1());
1266 EXPECT_TRUE(CheckRtcp1()); 1248 EXPECT_TRUE(CheckRtcp1());
1267 1249
1268 // Complete call setup and ensure everything is still OK. 1250 // Complete call setup and ensure everything is still OK.
1269 EXPECT_TRUE(SendAccept()); 1251 EXPECT_TRUE(SendAccept());
1270 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1252 EXPECT_EQ(2U, GetChannels1().size());
1271 SendRtcp1(); 1253 SendRtcp1();
1272 SendRtcp2(); 1254 SendRtcp2();
1273 WaitForThreads(); 1255 WaitForThreads();
1274 EXPECT_TRUE(CheckRtcp2()); 1256 EXPECT_TRUE(CheckRtcp2());
1275 EXPECT_TRUE(CheckRtcp1()); 1257 EXPECT_TRUE(CheckRtcp1());
1276 } 1258 }
1277 1259
1278 1260
1279 // Check that RTCP data is not muxed until both sides have enabled muxing, 1261 // Check that RTCP data is not muxed until both sides have enabled muxing,
1280 // but that we properly demux before we get the accept message, since there 1262 // but that we properly demux before we get the accept message, since there
1281 // is a race between RTP data and the jingle accept. 1263 // is a race between RTP data and the jingle accept.
1282 void SendEarlyRtcpMuxToRtcpMux() { 1264 void SendEarlyRtcpMuxToRtcpMux() {
1283 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1265 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1284 EXPECT_TRUE(SendInitiate()); 1266 EXPECT_TRUE(SendInitiate());
1285 ASSERT_TRUE(GetTransport1()); 1267 EXPECT_EQ(2U, GetChannels1().size());
1286 ASSERT_TRUE(GetTransport2()); 1268 EXPECT_EQ(1U, GetChannels2().size());
1287 EXPECT_EQ(2U, GetTransport1()->channels().size());
1288 EXPECT_EQ(1U, GetTransport2()->channels().size());
1289 1269
1290 // RTCP can't be sent yet, since the RTCP transport isn't writable, and 1270 // RTCP can't be sent yet, since the RTCP transport isn't writable, and
1291 // we haven't yet received the accept that says we should mux. 1271 // we haven't yet received the accept that says we should mux.
1292 SendRtcp1(); 1272 SendRtcp1();
1293 WaitForThreads(); 1273 WaitForThreads();
1294 EXPECT_TRUE(CheckNoRtcp2()); 1274 EXPECT_TRUE(CheckNoRtcp2());
1295 1275
1296 // Send muxed RTCP packet from callee and verify that it is received. 1276 // Send muxed RTCP packet from callee and verify that it is received.
1297 SendRtcp2(); 1277 SendRtcp2();
1298 WaitForThreads(); 1278 WaitForThreads();
1299 EXPECT_TRUE(CheckNoRtp1()); 1279 EXPECT_TRUE(CheckNoRtp1());
1300 EXPECT_TRUE(CheckRtcp1()); 1280 EXPECT_TRUE(CheckRtcp1());
1301 1281
1302 // Complete call setup and ensure everything is still OK. 1282 // Complete call setup and ensure everything is still OK.
1303 EXPECT_TRUE(SendAccept()); 1283 EXPECT_TRUE(SendAccept());
1304 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1284 EXPECT_EQ(1U, GetChannels1().size());
1305 SendRtcp1(); 1285 SendRtcp1();
1306 SendRtcp2(); 1286 SendRtcp2();
1307 WaitForThreads(); 1287 WaitForThreads();
1308 EXPECT_TRUE(CheckRtcp2()); 1288 EXPECT_TRUE(CheckRtcp2());
1309 EXPECT_TRUE(CheckRtcp1()); 1289 EXPECT_TRUE(CheckRtcp1());
1310 } 1290 }
1311 1291
1312 // Test that we properly send SRTP with RTCP in both directions. 1292 // Test that we properly send SRTP with RTCP in both directions.
1313 // You can pass in DTLS and/or RTCP_MUX as flags. 1293 // You can pass in DTLS and/or RTCP_MUX as flags.
1314 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { 1294 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. 1362 // sent and received. The test uses SRTP, RTCP mux and SSRC mux.
1383 void SendEarlyMediaUsingRtcpMuxSrtp() { 1363 void SendEarlyMediaUsingRtcpMuxSrtp() {
1384 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1364 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1385 1365
1386 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, 1366 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE,
1387 SSRC_MUX | RTCP | RTCP_MUX | SECURE); 1367 SSRC_MUX | RTCP | RTCP_MUX | SECURE);
1388 EXPECT_TRUE(SendOffer()); 1368 EXPECT_TRUE(SendOffer());
1389 EXPECT_TRUE(SendProvisionalAnswer()); 1369 EXPECT_TRUE(SendProvisionalAnswer());
1390 EXPECT_TRUE(channel1_->secure()); 1370 EXPECT_TRUE(channel1_->secure());
1391 EXPECT_TRUE(channel2_->secure()); 1371 EXPECT_TRUE(channel2_->secure());
1392 ASSERT_TRUE(GetTransport1()); 1372 EXPECT_EQ(2U, GetChannels1().size());
1393 ASSERT_TRUE(GetTransport2()); 1373 EXPECT_EQ(2U, GetChannels2().size());
1394 EXPECT_EQ(2U, GetTransport1()->channels().size());
1395 EXPECT_EQ(2U, GetTransport2()->channels().size());
1396 WaitForThreads(); // Wait for 'sending' flag go through network thread. 1374 WaitForThreads(); // Wait for 'sending' flag go through network thread.
1397 SendCustomRtcp1(kSsrc1); 1375 SendCustomRtcp1(kSsrc1);
1398 SendCustomRtp1(kSsrc1, ++sequence_number1_1); 1376 SendCustomRtp1(kSsrc1, ++sequence_number1_1);
1399 WaitForThreads(); 1377 WaitForThreads();
1400 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); 1378 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1));
1401 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); 1379 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1));
1402 1380
1403 // Send packets from callee and verify that it is received. 1381 // Send packets from callee and verify that it is received.
1404 SendCustomRtcp2(kSsrc2); 1382 SendCustomRtcp2(kSsrc2);
1405 SendCustomRtp2(kSsrc2, ++sequence_number2_2); 1383 SendCustomRtp2(kSsrc2, ++sequence_number2_2);
1406 WaitForThreads(); 1384 WaitForThreads();
1407 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); 1385 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2));
1408 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); 1386 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2));
1409 1387
1410 // Complete call setup and ensure everything is still OK. 1388 // Complete call setup and ensure everything is still OK.
1411 EXPECT_TRUE(SendFinalAnswer()); 1389 EXPECT_TRUE(SendFinalAnswer());
1412 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1390 EXPECT_EQ(1U, GetChannels1().size());
1413 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1391 EXPECT_EQ(1U, GetChannels2().size());
1414 EXPECT_TRUE(channel1_->secure()); 1392 EXPECT_TRUE(channel1_->secure());
1415 EXPECT_TRUE(channel2_->secure()); 1393 EXPECT_TRUE(channel2_->secure());
1416 SendCustomRtcp1(kSsrc1); 1394 SendCustomRtcp1(kSsrc1);
1417 SendCustomRtp1(kSsrc1, ++sequence_number1_1); 1395 SendCustomRtp1(kSsrc1, ++sequence_number1_1);
1418 SendCustomRtcp2(kSsrc2); 1396 SendCustomRtcp2(kSsrc2);
1419 SendCustomRtp2(kSsrc2, ++sequence_number2_2); 1397 SendCustomRtp2(kSsrc2, ++sequence_number2_2);
1420 WaitForThreads(); 1398 WaitForThreads();
1421 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); 1399 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1));
1422 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); 1400 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1));
1423 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); 1401 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 EXPECT_TRUE(CheckNoRtcp1()); 1447 EXPECT_TRUE(CheckNoRtcp1());
1470 EXPECT_TRUE(CheckNoRtcp2()); 1448 EXPECT_TRUE(CheckNoRtcp2());
1471 } 1449 }
1472 1450
1473 // Test that the mediachannel retains its sending state after the transport 1451 // Test that the mediachannel retains its sending state after the transport
1474 // becomes non-writable. 1452 // becomes non-writable.
1475 void SendWithWritabilityLoss() { 1453 void SendWithWritabilityLoss() {
1476 CreateChannels(0, 0); 1454 CreateChannels(0, 0);
1477 EXPECT_TRUE(SendInitiate()); 1455 EXPECT_TRUE(SendInitiate());
1478 EXPECT_TRUE(SendAccept()); 1456 EXPECT_TRUE(SendAccept());
1479 ASSERT_TRUE(GetTransport1()); 1457 EXPECT_EQ(1U, GetChannels1().size());
1480 ASSERT_TRUE(GetTransport2()); 1458 EXPECT_EQ(1U, GetChannels2().size());
1481 EXPECT_EQ(1U, GetTransport1()->channels().size());
1482 EXPECT_EQ(1U, GetTransport2()->channels().size());
1483 SendRtp1(); 1459 SendRtp1();
1484 SendRtp2(); 1460 SendRtp2();
1485 WaitForThreads(); 1461 WaitForThreads();
1486 EXPECT_TRUE(CheckRtp1()); 1462 EXPECT_TRUE(CheckRtp1());
1487 EXPECT_TRUE(CheckRtp2()); 1463 EXPECT_TRUE(CheckRtp2());
1488 EXPECT_TRUE(CheckNoRtp1()); 1464 EXPECT_TRUE(CheckNoRtp1());
1489 EXPECT_TRUE(CheckNoRtp2()); 1465 EXPECT_TRUE(CheckNoRtp2());
1490 1466
1491 // Lose writability, which should fail. 1467 // Lose writability, which should fail.
1492 network_thread_->Invoke<void>( 1468 network_thread_->Invoke<void>(
1493 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(false); }); 1469 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(false); });
1494 SendRtp1(); 1470 SendRtp1();
1495 SendRtp2(); 1471 SendRtp2();
1496 WaitForThreads(); 1472 WaitForThreads();
1497 EXPECT_TRUE(CheckRtp1()); 1473 EXPECT_TRUE(CheckRtp1());
1498 EXPECT_TRUE(CheckNoRtp2()); 1474 EXPECT_TRUE(CheckNoRtp2());
1499 1475
1500 // Regain writability 1476 // Regain writability
1501 network_thread_->Invoke<void>( 1477 network_thread_->Invoke<void>(
1502 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(true); }); 1478 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(true); });
1503 EXPECT_TRUE(media_channel1_->sending()); 1479 EXPECT_TRUE(media_channel1_->sending());
1504 SendRtp1(); 1480 SendRtp1();
1505 SendRtp2(); 1481 SendRtp2();
1506 WaitForThreads(); 1482 WaitForThreads();
1507 EXPECT_TRUE(CheckRtp1()); 1483 EXPECT_TRUE(CheckRtp1());
1508 EXPECT_TRUE(CheckRtp2()); 1484 EXPECT_TRUE(CheckRtp2());
1509 EXPECT_TRUE(CheckNoRtp1()); 1485 EXPECT_TRUE(CheckNoRtp1());
1510 EXPECT_TRUE(CheckNoRtp2()); 1486 EXPECT_TRUE(CheckNoRtp2());
1511 1487
1512 // Lose writability completely 1488 // Lose writability completely
1513 network_thread_->Invoke<void>( 1489 network_thread_->Invoke<void>(
1514 RTC_FROM_HERE, [this] { GetTransport1()->SetDestination(NULL); }); 1490 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetDestination(nullptr); });
1515 EXPECT_TRUE(media_channel1_->sending()); 1491 EXPECT_TRUE(media_channel1_->sending());
1516 1492
1517 // Should fail also. 1493 // Should fail also.
1518 SendRtp1(); 1494 SendRtp1();
1519 SendRtp2(); 1495 SendRtp2();
1520 WaitForThreads(); 1496 WaitForThreads();
1521 EXPECT_TRUE(CheckRtp1()); 1497 EXPECT_TRUE(CheckRtp1());
1522 EXPECT_TRUE(CheckNoRtp2()); 1498 EXPECT_TRUE(CheckNoRtp2());
1523 1499
1524 // Gain writability back 1500 // Gain writability back
1525 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { 1501 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] {
1526 GetTransport1()->SetDestination(GetTransport2()); 1502 GetFakeChannel1(1)->SetDestination(GetFakeChannel2(1));
1527 }); 1503 });
1528 EXPECT_TRUE(media_channel1_->sending()); 1504 EXPECT_TRUE(media_channel1_->sending());
1529 SendRtp1(); 1505 SendRtp1();
1530 SendRtp2(); 1506 SendRtp2();
1531 WaitForThreads(); 1507 WaitForThreads();
1532 EXPECT_TRUE(CheckRtp1()); 1508 EXPECT_TRUE(CheckRtp1());
1533 EXPECT_TRUE(CheckRtp2()); 1509 EXPECT_TRUE(CheckRtp2());
1534 EXPECT_TRUE(CheckNoRtp1()); 1510 EXPECT_TRUE(CheckNoRtp1());
1535 EXPECT_TRUE(CheckNoRtp2()); 1511 EXPECT_TRUE(CheckNoRtp2());
1536 } 1512 }
1537 1513
1538 void SendBundleToBundle( 1514 void SendBundleToBundle(
1539 const int* pl_types, int len, bool rtcp_mux, bool secure) { 1515 const int* pl_types, int len, bool rtcp_mux, bool secure) {
1540 ASSERT_EQ(2, len); 1516 ASSERT_EQ(2, len);
1541 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1517 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1542 // Only pl_type1 was added to the bundle filter for both |channel1_| 1518 // Only pl_type1 was added to the bundle filter for both |channel1_|
1543 // and |channel2_|. 1519 // and |channel2_|.
1544 int pl_type1 = pl_types[0]; 1520 int pl_type1 = pl_types[0];
1545 int pl_type2 = pl_types[1]; 1521 int pl_type2 = pl_types[1];
1546 int flags = SSRC_MUX | RTCP; 1522 int flags = SSRC_MUX | RTCP;
1547 if (secure) flags |= SECURE; 1523 if (secure) flags |= SECURE;
1548 uint32_t expected_channels = 2U; 1524 uint32_t expected_channels = 2U;
1549 if (rtcp_mux) { 1525 if (rtcp_mux) {
1550 flags |= RTCP_MUX; 1526 flags |= RTCP_MUX;
1551 expected_channels = 1U; 1527 expected_channels = 1U;
1552 } 1528 }
1553 CreateChannels(flags, flags); 1529 CreateChannels(flags, flags);
1554 EXPECT_TRUE(SendInitiate()); 1530 EXPECT_TRUE(SendInitiate());
1555 ASSERT_TRUE(GetTransport1()); 1531 EXPECT_EQ(2U, GetChannels1().size());
1556 ASSERT_TRUE(GetTransport2()); 1532 EXPECT_EQ(expected_channels, GetChannels2().size());
1557 EXPECT_EQ(2U, GetTransport1()->channels().size());
1558 EXPECT_EQ(expected_channels, GetTransport2()->channels().size());
1559 EXPECT_TRUE(SendAccept()); 1533 EXPECT_TRUE(SendAccept());
1560 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); 1534 EXPECT_EQ(expected_channels, GetChannels1().size());
1561 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); 1535 EXPECT_EQ(expected_channels, GetChannels2().size());
1562 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); 1536 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1));
1563 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); 1537 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1));
1564 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); 1538 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2));
1565 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); 1539 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2));
1566 1540
1567 // Both channels can receive pl_type1 only. 1541 // Both channels can receive pl_type1 only.
1568 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1); 1542 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1);
1569 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1); 1543 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1);
1570 WaitForThreads(); 1544 WaitForThreads();
1571 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1)); 1545 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1));
(...skipping 159 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
« no previous file with comments | « webrtc/p2p/quic/quictransport.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698