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

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed bugs with ICE connection state that occur when destroying transports Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #include "talk/media/base/fakemediaengine.h" 28 #include "talk/media/base/fakemediaengine.h"
29 #include "talk/media/base/fakertp.h" 29 #include "talk/media/base/fakertp.h"
30 #include "talk/media/base/fakescreencapturerfactory.h" 30 #include "talk/media/base/fakescreencapturerfactory.h"
31 #include "talk/media/base/fakevideocapturer.h" 31 #include "talk/media/base/fakevideocapturer.h"
32 #include "talk/media/base/mediachannel.h" 32 #include "talk/media/base/mediachannel.h"
33 #include "talk/media/base/rtpdump.h" 33 #include "talk/media/base/rtpdump.h"
34 #include "talk/media/base/screencastid.h" 34 #include "talk/media/base/screencastid.h"
35 #include "talk/media/base/testutils.h" 35 #include "talk/media/base/testutils.h"
36 #include "webrtc/p2p/base/fakesession.h" 36 #include "webrtc/p2p/base/faketransportcontroller.h"
37 #include "talk/session/media/channel.h" 37 #include "talk/session/media/channel.h"
38 #include "webrtc/base/fileutils.h" 38 #include "webrtc/base/fileutils.h"
39 #include "webrtc/base/gunit.h" 39 #include "webrtc/base/gunit.h"
40 #include "webrtc/base/helpers.h" 40 #include "webrtc/base/helpers.h"
41 #include "webrtc/base/logging.h" 41 #include "webrtc/base/logging.h"
42 #include "webrtc/base/pathutils.h" 42 #include "webrtc/base/pathutils.h"
43 #include "webrtc/base/signalthread.h" 43 #include "webrtc/base/signalthread.h"
44 #include "webrtc/base/ssladapter.h" 44 #include "webrtc/base/ssladapter.h"
45 #include "webrtc/base/sslidentity.h" 45 #include "webrtc/base/sslidentity.h"
46 #include "webrtc/base/window.h" 46 #include "webrtc/base/window.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 rtc::Pathname(path), "wb"); 118 rtc::Pathname(path), "wb");
119 } 119 }
120 120
121 // Base class for Voice/VideoChannel tests 121 // Base class for Voice/VideoChannel tests
122 template<class T> 122 template<class T>
123 class ChannelTest : public testing::Test, public sigslot::has_slots<> { 123 class ChannelTest : public testing::Test, public sigslot::has_slots<> {
124 public: 124 public:
125 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, 125 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8,
126 DTLS = 0x10 }; 126 DTLS = 0x10 };
127 127
128 ChannelTest(const uint8* rtp_data, int rtp_len, 128 ChannelTest(const uint8* rtp_data,
129 const uint8* rtcp_data, int rtcp_len) 129 int rtp_len,
130 : session1_(true), 130 const uint8* rtcp_data,
131 session2_(false), 131 int rtcp_len)
132 : transport_controller1_(cricket::ICEROLE_CONTROLLING),
133 transport_controller2_(cricket::ICEROLE_CONTROLLED),
132 media_channel1_(NULL), 134 media_channel1_(NULL),
133 media_channel2_(NULL), 135 media_channel2_(NULL),
134 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), 136 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len),
135 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), 137 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len),
136 media_info_callbacks1_(), 138 media_info_callbacks1_(),
137 media_info_callbacks2_(), 139 media_info_callbacks2_(),
138 ssrc_(0), 140 ssrc_(0),
139 error_(T::MediaChannel::ERROR_NONE) { 141 error_(T::MediaChannel::ERROR_NONE) {}
140 }
141 142
142 void CreateChannels(int flags1, int flags2) { 143 void CreateChannels(int flags1, int flags2) {
143 CreateChannels(new typename T::MediaChannel(NULL), 144 CreateChannels(new typename T::MediaChannel(NULL),
144 new typename T::MediaChannel(NULL), 145 new typename T::MediaChannel(NULL),
145 flags1, flags2, rtc::Thread::Current()); 146 flags1, flags2, rtc::Thread::Current());
146 } 147 }
147 void CreateChannels(int flags) { 148 void CreateChannels(int flags) {
148 CreateChannels(new typename T::MediaChannel(NULL), 149 CreateChannels(new typename T::MediaChannel(NULL),
149 new typename T::MediaChannel(NULL), 150 new typename T::MediaChannel(NULL),
150 flags, rtc::Thread::Current()); 151 flags, rtc::Thread::Current());
151 } 152 }
152 void CreateChannels(int flags1, int flags2, 153 void CreateChannels(int flags1, int flags2,
153 rtc::Thread* thread) { 154 rtc::Thread* thread) {
154 CreateChannels(new typename T::MediaChannel(NULL), 155 CreateChannels(new typename T::MediaChannel(NULL),
155 new typename T::MediaChannel(NULL), 156 new typename T::MediaChannel(NULL),
156 flags1, flags2, thread); 157 flags1, flags2, thread);
157 } 158 }
158 void CreateChannels(int flags, 159 void CreateChannels(int flags,
159 rtc::Thread* thread) { 160 rtc::Thread* thread) {
160 CreateChannels(new typename T::MediaChannel(NULL), 161 CreateChannels(new typename T::MediaChannel(NULL),
161 new typename T::MediaChannel(NULL), 162 new typename T::MediaChannel(NULL),
162 flags, thread); 163 flags, thread);
163 } 164 }
164 void CreateChannels( 165 void CreateChannels(
165 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, 166 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2,
166 int flags1, int flags2, rtc::Thread* thread) { 167 int flags1, int flags2, rtc::Thread* thread) {
167 media_channel1_ = ch1; 168 media_channel1_ = ch1;
168 media_channel2_ = ch2; 169 media_channel2_ = ch2;
169 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_, 170 channel1_.reset(CreateChannel(thread, &media_engine_, ch1,
171 &transport_controller1_,
170 (flags1 & RTCP) != 0)); 172 (flags1 & RTCP) != 0));
171 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session2_, 173 channel2_.reset(CreateChannel(thread, &media_engine_, ch2,
174 &transport_controller2_,
172 (flags2 & RTCP) != 0)); 175 (flags2 & RTCP) != 0));
173 channel1_->SignalMediaMonitor.connect( 176 channel1_->SignalMediaMonitor.connect(
174 this, &ChannelTest<T>::OnMediaMonitor); 177 this, &ChannelTest<T>::OnMediaMonitor);
175 channel2_->SignalMediaMonitor.connect( 178 channel2_->SignalMediaMonitor.connect(
176 this, &ChannelTest<T>::OnMediaMonitor); 179 this, &ChannelTest<T>::OnMediaMonitor);
177 channel1_->SignalMediaError.connect( 180 channel1_->SignalMediaError.connect(
178 this, &ChannelTest<T>::OnMediaChannelError); 181 this, &ChannelTest<T>::OnMediaChannelError);
179 channel2_->SignalMediaError.connect( 182 channel2_->SignalMediaError.connect(
180 this, &ChannelTest<T>::OnMediaChannelError); 183 this, &ChannelTest<T>::OnMediaChannelError);
181 if ((flags1 & DTLS) && (flags2 & DTLS)) { 184 if ((flags1 & DTLS) && (flags2 & DTLS)) {
182 flags1 = (flags1 & ~SECURE); 185 flags1 = (flags1 & ~SECURE);
183 flags2 = (flags2 & ~SECURE); 186 flags2 = (flags2 & ~SECURE);
184 } 187 }
185 CreateContent(flags1, kPcmuCodec, kH264Codec, 188 CreateContent(flags1, kPcmuCodec, kH264Codec,
186 &local_media_content1_); 189 &local_media_content1_);
187 CreateContent(flags2, kPcmuCodec, kH264Codec, 190 CreateContent(flags2, kPcmuCodec, kH264Codec,
188 &local_media_content2_); 191 &local_media_content2_);
189 CopyContent(local_media_content1_, &remote_media_content1_); 192 CopyContent(local_media_content1_, &remote_media_content1_);
190 CopyContent(local_media_content2_, &remote_media_content2_); 193 CopyContent(local_media_content2_, &remote_media_content2_);
191 194
192 if (flags1 & DTLS) { 195 if (flags1 & DTLS) {
193 // Confirmed to work with KT_RSA and KT_ECDSA. 196 // Confirmed to work with KT_RSA and KT_ECDSA.
194 session1_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( 197 transport_controller1_.SetLocalCertificate(rtc::RTCCertificate::Create(
195 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( 198 rtc::scoped_ptr<rtc::SSLIdentity>(
196 "session1", rtc::KT_DEFAULT)).Pass())); 199 rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)).Pass()));
197 } 200 }
198 if (flags2 & DTLS) { 201 if (flags2 & DTLS) {
199 // Confirmed to work with KT_RSA and KT_ECDSA. 202 // Confirmed to work with KT_RSA and KT_ECDSA.
200 session2_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( 203 transport_controller2_.SetLocalCertificate(rtc::RTCCertificate::Create(
201 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( 204 rtc::scoped_ptr<rtc::SSLIdentity>(
202 "session2", rtc::KT_DEFAULT)).Pass())); 205 rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)).Pass()));
203 } 206 }
204 207
205 // Add stream information (SSRC) to the local content but not to the remote 208 // Add stream information (SSRC) to the local content but not to the remote
206 // content. This means that we per default know the SSRC of what we send but 209 // content. This means that we per default know the SSRC of what we send but
207 // not what we receive. 210 // not what we receive.
208 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); 211 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_);
209 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); 212 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_);
210 213
211 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. 214 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream.
212 if (flags1 & SSRC_MUX) { 215 if (flags1 & SSRC_MUX) {
213 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); 216 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_);
214 } 217 }
215 if (flags2 & SSRC_MUX) { 218 if (flags2 & SSRC_MUX) {
216 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); 219 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_);
217 } 220 }
218 } 221 }
219 222
220 void CreateChannels( 223 void CreateChannels(
221 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, 224 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2,
222 int flags, rtc::Thread* thread) { 225 int flags, rtc::Thread* thread) {
223 media_channel1_ = ch1; 226 media_channel1_ = ch1;
224 media_channel2_ = ch2; 227 media_channel2_ = ch2;
225 228
226 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_, 229 channel1_.reset(CreateChannel(thread, &media_engine_, ch1,
230 &transport_controller1_,
227 (flags & RTCP) != 0)); 231 (flags & RTCP) != 0));
228 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session1_, 232 channel2_.reset(CreateChannel(thread, &media_engine_, ch2,
233 &transport_controller1_,
229 (flags & RTCP) != 0)); 234 (flags & RTCP) != 0));
230 channel1_->SignalMediaMonitor.connect( 235 channel1_->SignalMediaMonitor.connect(
231 this, &ChannelTest<T>::OnMediaMonitor); 236 this, &ChannelTest<T>::OnMediaMonitor);
232 channel2_->SignalMediaMonitor.connect( 237 channel2_->SignalMediaMonitor.connect(
233 this, &ChannelTest<T>::OnMediaMonitor); 238 this, &ChannelTest<T>::OnMediaMonitor);
234 channel2_->SignalMediaError.connect( 239 channel2_->SignalMediaError.connect(
235 this, &ChannelTest<T>::OnMediaChannelError); 240 this, &ChannelTest<T>::OnMediaChannelError);
236 CreateContent(flags, kPcmuCodec, kH264Codec, 241 CreateContent(flags, kPcmuCodec, kH264Codec,
237 &local_media_content1_); 242 &local_media_content1_);
238 CreateContent(flags, kPcmuCodec, kH264Codec, 243 CreateContent(flags, kPcmuCodec, kH264Codec,
239 &local_media_content2_); 244 &local_media_content2_);
240 CopyContent(local_media_content1_, &remote_media_content1_); 245 CopyContent(local_media_content1_, &remote_media_content1_);
241 CopyContent(local_media_content2_, &remote_media_content2_); 246 CopyContent(local_media_content2_, &remote_media_content2_);
242 // Add stream information (SSRC) to the local content but not to the remote 247 // Add stream information (SSRC) to the local content but not to the remote
243 // content. This means that we per default know the SSRC of what we send but 248 // content. This means that we per default know the SSRC of what we send but
244 // not what we receive. 249 // not what we receive.
245 AddLegacyStreamInContent(kSsrc1, flags, &local_media_content1_); 250 AddLegacyStreamInContent(kSsrc1, flags, &local_media_content1_);
246 AddLegacyStreamInContent(kSsrc2, flags, &local_media_content2_); 251 AddLegacyStreamInContent(kSsrc2, flags, &local_media_content2_);
247 252
248 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. 253 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream.
249 if (flags & SSRC_MUX) { 254 if (flags & SSRC_MUX) {
250 AddLegacyStreamInContent(kSsrc1, flags, &remote_media_content1_); 255 AddLegacyStreamInContent(kSsrc1, flags, &remote_media_content1_);
251 AddLegacyStreamInContent(kSsrc2, flags, &remote_media_content2_); 256 AddLegacyStreamInContent(kSsrc2, flags, &remote_media_content2_);
252 } 257 }
253 } 258 }
254 259
255 typename T::Channel* CreateChannel(rtc::Thread* thread, 260 typename T::Channel* CreateChannel(
256 cricket::MediaEngineInterface* engine, 261 rtc::Thread* thread,
257 typename T::MediaChannel* ch, 262 cricket::MediaEngineInterface* engine,
258 cricket::BaseSession* session, 263 typename T::MediaChannel* ch,
259 bool rtcp) { 264 cricket::TransportController* transport_controller,
265 bool rtcp) {
260 typename T::Channel* channel = new typename T::Channel( 266 typename T::Channel* channel = new typename T::Channel(
261 thread, engine, ch, session, cricket::CN_AUDIO, rtcp); 267 thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp);
262 if (!channel->Init()) { 268 if (!channel->Init()) {
263 delete channel; 269 delete channel;
264 channel = NULL; 270 channel = NULL;
265 } 271 }
266 return channel; 272 return channel;
267 } 273 }
268 274
269 bool SendInitiate() { 275 bool SendInitiate() {
270 bool result = channel1_->SetLocalContent(&local_media_content1_, 276 bool result = channel1_->SetLocalContent(&local_media_content1_,
271 CA_OFFER, NULL); 277 CA_OFFER, NULL);
272 if (result) { 278 if (result) {
273 channel1_->Enable(true); 279 channel1_->Enable(true);
274 result = channel2_->SetRemoteContent(&remote_media_content1_, 280 result = channel2_->SetRemoteContent(&remote_media_content1_,
275 CA_OFFER, NULL); 281 CA_OFFER, NULL);
276 if (result) { 282 if (result) {
277 session1_.Connect(&session2_); 283 transport_controller1_.Connect(&transport_controller2_);
278 284
279 result = channel2_->SetLocalContent(&local_media_content2_, 285 result = channel2_->SetLocalContent(&local_media_content2_,
280 CA_ANSWER, NULL); 286 CA_ANSWER, NULL);
281 } 287 }
282 } 288 }
283 return result; 289 return result;
284 } 290 }
285 291
286 bool SendAccept() { 292 bool SendAccept() {
287 channel2_->Enable(true); 293 channel2_->Enable(true);
(...skipping 12 matching lines...) Expand all
300 return result; 306 return result;
301 } 307 }
302 308
303 bool SendProvisionalAnswer() { 309 bool SendProvisionalAnswer() {
304 bool result = channel2_->SetLocalContent(&local_media_content2_, 310 bool result = channel2_->SetLocalContent(&local_media_content2_,
305 CA_PRANSWER, NULL); 311 CA_PRANSWER, NULL);
306 if (result) { 312 if (result) {
307 channel2_->Enable(true); 313 channel2_->Enable(true);
308 result = channel1_->SetRemoteContent(&remote_media_content2_, 314 result = channel1_->SetRemoteContent(&remote_media_content2_,
309 CA_PRANSWER, NULL); 315 CA_PRANSWER, NULL);
310 session1_.Connect(&session2_); 316 transport_controller1_.Connect(&transport_controller2_);
311 } 317 }
312 return result; 318 return result;
313 } 319 }
314 320
315 bool SendFinalAnswer() { 321 bool SendFinalAnswer() {
316 bool result = channel2_->SetLocalContent(&local_media_content2_, 322 bool result = channel2_->SetLocalContent(&local_media_content2_,
317 CA_ANSWER, NULL); 323 CA_ANSWER, NULL);
318 if (result) 324 if (result)
319 result = channel1_->SetRemoteContent(&remote_media_content2_, 325 result = channel1_->SetRemoteContent(&remote_media_content2_,
320 CA_ANSWER, NULL); 326 CA_ANSWER, NULL);
321 return result; 327 return result;
322 } 328 }
323 329
324 bool SendTerminate() { 330 bool SendTerminate() {
325 channel1_.reset(); 331 channel1_.reset();
326 channel2_.reset(); 332 channel2_.reset();
327 return true; 333 return true;
328 } 334 }
329 335
330 bool AddStream1(int id) { 336 bool AddStream1(int id) {
331 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); 337 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id));
332 } 338 }
333 bool RemoveStream1(int id) { 339 bool RemoveStream1(int id) {
334 return channel1_->RemoveRecvStream(id); 340 return channel1_->RemoveRecvStream(id);
335 } 341 }
336 342
343 // Calling "_w" method here is ok since we only use one thread for this test
337 cricket::FakeTransport* GetTransport1() { 344 cricket::FakeTransport* GetTransport1() {
338 return session1_.GetTransport(channel1_->content_name()); 345 return transport_controller1_.GetTransport_w(channel1_->content_name());
339 } 346 }
340 cricket::FakeTransport* GetTransport2() { 347 cricket::FakeTransport* GetTransport2() {
341 return session2_.GetTransport(channel2_->content_name()); 348 return transport_controller2_.GetTransport_w(channel2_->content_name());
342 } 349 }
343 350
344 bool SendRtp1() { 351 bool SendRtp1() {
345 return media_channel1_->SendRtp(rtp_packet_.c_str(), 352 return media_channel1_->SendRtp(rtp_packet_.c_str(),
346 static_cast<int>(rtp_packet_.size())); 353 static_cast<int>(rtp_packet_.size()));
347 } 354 }
348 bool SendRtp2() { 355 bool SendRtp2() {
349 return media_channel2_->SendRtp(rtp_packet_.c_str(), 356 return media_channel2_->SendRtp(rtp_packet_.c_str(),
350 static_cast<int>(rtp_packet_.size())); 357 static_cast<int>(rtp_packet_.size()));
351 } 358 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 CreateChannels(0, 0); 817 CreateChannels(0, 0);
811 typename T::Content content1; 818 typename T::Content content1;
812 CreateContent(0, kPcmuCodec, kH264Codec, &content1); 819 CreateContent(0, kPcmuCodec, kH264Codec, &content1);
813 content1.AddStream(stream1); 820 content1.AddStream(stream1);
814 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); 821 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL));
815 EXPECT_TRUE(channel1_->Enable(true)); 822 EXPECT_TRUE(channel1_->Enable(true));
816 EXPECT_EQ(1u, media_channel1_->send_streams().size()); 823 EXPECT_EQ(1u, media_channel1_->send_streams().size());
817 824
818 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); 825 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL));
819 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); 826 EXPECT_EQ(1u, media_channel2_->recv_streams().size());
820 session1_.Connect(&session2_); 827 transport_controller1_.Connect(&transport_controller2_);
821 828
822 // Channel 2 do not send anything. 829 // Channel 2 do not send anything.
823 typename T::Content content2; 830 typename T::Content content2;
824 CreateContent(0, kPcmuCodec, kH264Codec, &content2); 831 CreateContent(0, kPcmuCodec, kH264Codec, &content2);
825 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); 832 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL));
826 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); 833 EXPECT_EQ(0u, media_channel1_->recv_streams().size());
827 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); 834 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL));
828 EXPECT_TRUE(channel2_->Enable(true)); 835 EXPECT_TRUE(channel2_->Enable(true));
829 EXPECT_EQ(0u, media_channel2_->send_streams().size()); 836 EXPECT_EQ(0u, media_channel2_->send_streams().size());
830 837
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 EXPECT_TRUE(media_channel1_->playout()); 880 EXPECT_TRUE(media_channel1_->playout());
874 EXPECT_FALSE(media_channel1_->sending()); 881 EXPECT_FALSE(media_channel1_->sending());
875 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, 882 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_,
876 CA_OFFER, NULL)); 883 CA_OFFER, NULL));
877 EXPECT_FALSE(media_channel2_->playout()); 884 EXPECT_FALSE(media_channel2_->playout());
878 EXPECT_FALSE(media_channel2_->sending()); 885 EXPECT_FALSE(media_channel2_->sending());
879 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, 886 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_,
880 CA_ANSWER, NULL)); 887 CA_ANSWER, NULL));
881 EXPECT_FALSE(media_channel2_->playout()); 888 EXPECT_FALSE(media_channel2_->playout());
882 EXPECT_FALSE(media_channel2_->sending()); 889 EXPECT_FALSE(media_channel2_->sending());
883 session1_.Connect(&session2_); 890 transport_controller1_.Connect(&transport_controller2_);
884 EXPECT_TRUE(media_channel1_->playout()); 891 EXPECT_TRUE(media_channel1_->playout());
885 EXPECT_FALSE(media_channel1_->sending()); 892 EXPECT_FALSE(media_channel1_->sending());
886 EXPECT_FALSE(media_channel2_->playout()); 893 EXPECT_FALSE(media_channel2_->playout());
887 EXPECT_FALSE(media_channel2_->sending()); 894 EXPECT_FALSE(media_channel2_->sending());
888 EXPECT_TRUE(channel2_->Enable(true)); 895 EXPECT_TRUE(channel2_->Enable(true));
889 EXPECT_TRUE(media_channel2_->playout()); 896 EXPECT_TRUE(media_channel2_->playout());
890 EXPECT_TRUE(media_channel2_->sending()); 897 EXPECT_TRUE(media_channel2_->sending());
891 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, 898 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_,
892 CA_ANSWER, NULL)); 899 CA_ANSWER, NULL));
893 EXPECT_TRUE(media_channel1_->playout()); 900 EXPECT_TRUE(media_channel1_->playout());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 EXPECT_TRUE(channel2_->Enable(true)); 938 EXPECT_TRUE(channel2_->Enable(true));
932 EXPECT_FALSE(media_channel1_->playout()); 939 EXPECT_FALSE(media_channel1_->playout());
933 EXPECT_FALSE(media_channel1_->sending()); 940 EXPECT_FALSE(media_channel1_->sending());
934 EXPECT_FALSE(media_channel2_->playout()); 941 EXPECT_FALSE(media_channel2_->playout());
935 EXPECT_FALSE(media_channel2_->sending()); 942 EXPECT_FALSE(media_channel2_->sending());
936 943
937 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); 944 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL));
938 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); 945 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL));
939 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); 946 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL));
940 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); 947 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL));
941 session1_.Connect(&session2_); 948 transport_controller1_.Connect(&transport_controller2_);
942 949
943 EXPECT_TRUE(media_channel1_->playout()); 950 EXPECT_TRUE(media_channel1_->playout());
944 EXPECT_FALSE(media_channel1_->sending()); // remote InActive 951 EXPECT_FALSE(media_channel1_->sending()); // remote InActive
945 EXPECT_FALSE(media_channel2_->playout()); // local InActive 952 EXPECT_FALSE(media_channel2_->playout()); // local InActive
946 EXPECT_FALSE(media_channel2_->sending()); // local InActive 953 EXPECT_FALSE(media_channel2_->sending()); // local InActive
947 954
948 // Update |content2| to be RecvOnly. 955 // Update |content2| to be RecvOnly.
949 content2.set_direction(cricket::MD_RECVONLY); 956 content2.set_direction(cricket::MD_RECVONLY);
950 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); 957 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL));
951 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); 958 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 EXPECT_TRUE(SendInitiate()); 1008 EXPECT_TRUE(SendInitiate());
1002 EXPECT_TRUE(SendAccept()); 1009 EXPECT_TRUE(SendAccept());
1003 EXPECT_TRUE(SendTerminate()); 1010 EXPECT_TRUE(SendTerminate());
1004 } 1011 }
1005 1012
1006 // Send voice RTP data to the other side and ensure it gets there. 1013 // Send voice RTP data to the other side and ensure it gets there.
1007 void SendRtpToRtp() { 1014 void SendRtpToRtp() {
1008 CreateChannels(0, 0); 1015 CreateChannels(0, 0);
1009 EXPECT_TRUE(SendInitiate()); 1016 EXPECT_TRUE(SendInitiate());
1010 EXPECT_TRUE(SendAccept()); 1017 EXPECT_TRUE(SendAccept());
1018 ASSERT_TRUE(GetTransport1());
1019 ASSERT_TRUE(GetTransport2());
1011 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1020 EXPECT_EQ(1U, GetTransport1()->channels().size());
1012 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1021 EXPECT_EQ(1U, GetTransport2()->channels().size());
1013 EXPECT_TRUE(SendRtp1()); 1022 EXPECT_TRUE(SendRtp1());
1014 EXPECT_TRUE(SendRtp2()); 1023 EXPECT_TRUE(SendRtp2());
1015 EXPECT_TRUE(CheckRtp1()); 1024 EXPECT_TRUE(CheckRtp1());
1016 EXPECT_TRUE(CheckRtp2()); 1025 EXPECT_TRUE(CheckRtp2());
1017 EXPECT_TRUE(CheckNoRtp1()); 1026 EXPECT_TRUE(CheckNoRtp1());
1018 EXPECT_TRUE(CheckNoRtp2()); 1027 EXPECT_TRUE(CheckNoRtp2());
1019 } 1028 }
1020 1029
1021 // Check that RTCP is not transmitted if both sides don't support RTCP. 1030 // Check that RTCP is not transmitted if both sides don't support RTCP.
1022 void SendNoRtcpToNoRtcp() { 1031 void SendNoRtcpToNoRtcp() {
1023 CreateChannels(0, 0); 1032 CreateChannels(0, 0);
1024 EXPECT_TRUE(SendInitiate()); 1033 EXPECT_TRUE(SendInitiate());
1025 EXPECT_TRUE(SendAccept()); 1034 EXPECT_TRUE(SendAccept());
1035 ASSERT_TRUE(GetTransport1());
1036 ASSERT_TRUE(GetTransport2());
1026 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1037 EXPECT_EQ(1U, GetTransport1()->channels().size());
1027 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1038 EXPECT_EQ(1U, GetTransport2()->channels().size());
1028 EXPECT_FALSE(SendRtcp1()); 1039 EXPECT_FALSE(SendRtcp1());
1029 EXPECT_FALSE(SendRtcp2()); 1040 EXPECT_FALSE(SendRtcp2());
1030 EXPECT_TRUE(CheckNoRtcp1()); 1041 EXPECT_TRUE(CheckNoRtcp1());
1031 EXPECT_TRUE(CheckNoRtcp2()); 1042 EXPECT_TRUE(CheckNoRtcp2());
1032 } 1043 }
1033 1044
1034 // Check that RTCP is not transmitted if the callee doesn't support RTCP. 1045 // Check that RTCP is not transmitted if the callee doesn't support RTCP.
1035 void SendNoRtcpToRtcp() { 1046 void SendNoRtcpToRtcp() {
1036 CreateChannels(0, RTCP); 1047 CreateChannels(0, RTCP);
1037 EXPECT_TRUE(SendInitiate()); 1048 EXPECT_TRUE(SendInitiate());
1038 EXPECT_TRUE(SendAccept()); 1049 EXPECT_TRUE(SendAccept());
1050 ASSERT_TRUE(GetTransport1());
1051 ASSERT_TRUE(GetTransport2());
1039 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1052 EXPECT_EQ(1U, GetTransport1()->channels().size());
1040 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1053 EXPECT_EQ(2U, GetTransport2()->channels().size());
1041 EXPECT_FALSE(SendRtcp1()); 1054 EXPECT_FALSE(SendRtcp1());
1042 EXPECT_FALSE(SendRtcp2()); 1055 EXPECT_FALSE(SendRtcp2());
1043 EXPECT_TRUE(CheckNoRtcp1()); 1056 EXPECT_TRUE(CheckNoRtcp1());
1044 EXPECT_TRUE(CheckNoRtcp2()); 1057 EXPECT_TRUE(CheckNoRtcp2());
1045 } 1058 }
1046 1059
1047 // Check that RTCP is not transmitted if the caller doesn't support RTCP. 1060 // Check that RTCP is not transmitted if the caller doesn't support RTCP.
1048 void SendRtcpToNoRtcp() { 1061 void SendRtcpToNoRtcp() {
1049 CreateChannels(RTCP, 0); 1062 CreateChannels(RTCP, 0);
1050 EXPECT_TRUE(SendInitiate()); 1063 EXPECT_TRUE(SendInitiate());
1051 EXPECT_TRUE(SendAccept()); 1064 EXPECT_TRUE(SendAccept());
1065 ASSERT_TRUE(GetTransport1());
1066 ASSERT_TRUE(GetTransport2());
1052 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1067 EXPECT_EQ(2U, GetTransport1()->channels().size());
1053 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1068 EXPECT_EQ(1U, GetTransport2()->channels().size());
1054 EXPECT_FALSE(SendRtcp1()); 1069 EXPECT_FALSE(SendRtcp1());
1055 EXPECT_FALSE(SendRtcp2()); 1070 EXPECT_FALSE(SendRtcp2());
1056 EXPECT_TRUE(CheckNoRtcp1()); 1071 EXPECT_TRUE(CheckNoRtcp1());
1057 EXPECT_TRUE(CheckNoRtcp2()); 1072 EXPECT_TRUE(CheckNoRtcp2());
1058 } 1073 }
1059 1074
1060 // Check that RTCP is transmitted if both sides support RTCP. 1075 // Check that RTCP is transmitted if both sides support RTCP.
1061 void SendRtcpToRtcp() { 1076 void SendRtcpToRtcp() {
1062 CreateChannels(RTCP, RTCP); 1077 CreateChannels(RTCP, RTCP);
1063 EXPECT_TRUE(SendInitiate()); 1078 EXPECT_TRUE(SendInitiate());
1064 EXPECT_TRUE(SendAccept()); 1079 EXPECT_TRUE(SendAccept());
1080 ASSERT_TRUE(GetTransport1());
1081 ASSERT_TRUE(GetTransport2());
1065 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1082 EXPECT_EQ(2U, GetTransport1()->channels().size());
1066 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1083 EXPECT_EQ(2U, GetTransport2()->channels().size());
1067 EXPECT_TRUE(SendRtcp1()); 1084 EXPECT_TRUE(SendRtcp1());
1068 EXPECT_TRUE(SendRtcp2()); 1085 EXPECT_TRUE(SendRtcp2());
1069 EXPECT_TRUE(CheckRtcp1()); 1086 EXPECT_TRUE(CheckRtcp1());
1070 EXPECT_TRUE(CheckRtcp2()); 1087 EXPECT_TRUE(CheckRtcp2());
1071 EXPECT_TRUE(CheckNoRtcp1()); 1088 EXPECT_TRUE(CheckNoRtcp1());
1072 EXPECT_TRUE(CheckNoRtcp2()); 1089 EXPECT_TRUE(CheckNoRtcp2());
1073 } 1090 }
1074 1091
1075 // Check that RTCP is transmitted if only the initiator supports mux. 1092 // Check that RTCP is transmitted if only the initiator supports mux.
1076 void SendRtcpMuxToRtcp() { 1093 void SendRtcpMuxToRtcp() {
1077 CreateChannels(RTCP | RTCP_MUX, RTCP); 1094 CreateChannels(RTCP | RTCP_MUX, RTCP);
1078 EXPECT_TRUE(SendInitiate()); 1095 EXPECT_TRUE(SendInitiate());
1079 EXPECT_TRUE(SendAccept()); 1096 EXPECT_TRUE(SendAccept());
1097 ASSERT_TRUE(GetTransport1());
1098 ASSERT_TRUE(GetTransport2());
1080 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1099 EXPECT_EQ(2U, GetTransport1()->channels().size());
1081 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1100 EXPECT_EQ(2U, GetTransport2()->channels().size());
1082 EXPECT_TRUE(SendRtcp1()); 1101 EXPECT_TRUE(SendRtcp1());
1083 EXPECT_TRUE(SendRtcp2()); 1102 EXPECT_TRUE(SendRtcp2());
1084 EXPECT_TRUE(CheckRtcp1()); 1103 EXPECT_TRUE(CheckRtcp1());
1085 EXPECT_TRUE(CheckRtcp2()); 1104 EXPECT_TRUE(CheckRtcp2());
1086 EXPECT_TRUE(CheckNoRtcp1()); 1105 EXPECT_TRUE(CheckNoRtcp1());
1087 EXPECT_TRUE(CheckNoRtcp2()); 1106 EXPECT_TRUE(CheckNoRtcp2());
1088 } 1107 }
1089 1108
1090 // Check that RTP and RTCP are transmitted ok when both sides support mux. 1109 // Check that RTP and RTCP are transmitted ok when both sides support mux.
1091 void SendRtcpMuxToRtcpMux() { 1110 void SendRtcpMuxToRtcpMux() {
1092 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1111 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1093 EXPECT_TRUE(SendInitiate()); 1112 EXPECT_TRUE(SendInitiate());
1113 ASSERT_TRUE(GetTransport1());
1114 ASSERT_TRUE(GetTransport2());
1094 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1115 EXPECT_EQ(2U, GetTransport1()->channels().size());
1095 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1116 EXPECT_EQ(1U, GetTransport2()->channels().size());
1096 EXPECT_TRUE(SendAccept()); 1117 EXPECT_TRUE(SendAccept());
1097 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1118 EXPECT_EQ(1U, GetTransport1()->channels().size());
1098 EXPECT_TRUE(SendRtp1()); 1119 EXPECT_TRUE(SendRtp1());
1099 EXPECT_TRUE(SendRtp2()); 1120 EXPECT_TRUE(SendRtp2());
1100 EXPECT_TRUE(SendRtcp1()); 1121 EXPECT_TRUE(SendRtcp1());
1101 EXPECT_TRUE(SendRtcp2()); 1122 EXPECT_TRUE(SendRtcp2());
1102 EXPECT_TRUE(CheckRtp1()); 1123 EXPECT_TRUE(CheckRtp1());
1103 EXPECT_TRUE(CheckRtp2()); 1124 EXPECT_TRUE(CheckRtp2());
1104 EXPECT_TRUE(CheckNoRtp1()); 1125 EXPECT_TRUE(CheckNoRtp1());
1105 EXPECT_TRUE(CheckNoRtp2()); 1126 EXPECT_TRUE(CheckNoRtp2());
1106 EXPECT_TRUE(CheckRtcp1()); 1127 EXPECT_TRUE(CheckRtcp1());
1107 EXPECT_TRUE(CheckRtcp2()); 1128 EXPECT_TRUE(CheckRtcp2());
1108 EXPECT_TRUE(CheckNoRtcp1()); 1129 EXPECT_TRUE(CheckNoRtcp1());
1109 EXPECT_TRUE(CheckNoRtcp2()); 1130 EXPECT_TRUE(CheckNoRtcp2());
1110 } 1131 }
1111 1132
1112 // Check that RTP and RTCP are transmitted ok when both sides 1133 // Check that RTP and RTCP are transmitted ok when both sides
1113 // support mux and one the offerer requires mux. 1134 // support mux and one the offerer requires mux.
1114 void SendRequireRtcpMuxToRtcpMux() { 1135 void SendRequireRtcpMuxToRtcpMux() {
1115 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1136 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1116 channel1_->ActivateRtcpMux(); 1137 channel1_->ActivateRtcpMux();
1117 EXPECT_TRUE(SendInitiate()); 1138 EXPECT_TRUE(SendInitiate());
1139 ASSERT_TRUE(GetTransport1());
1140 ASSERT_TRUE(GetTransport2());
1118 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1141 EXPECT_EQ(1U, GetTransport1()->channels().size());
1119 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1142 EXPECT_EQ(1U, GetTransport2()->channels().size());
1120 EXPECT_TRUE(SendAccept()); 1143 EXPECT_TRUE(SendAccept());
1121 EXPECT_TRUE(SendRtp1()); 1144 EXPECT_TRUE(SendRtp1());
1122 EXPECT_TRUE(SendRtp2()); 1145 EXPECT_TRUE(SendRtp2());
1123 EXPECT_TRUE(SendRtcp1()); 1146 EXPECT_TRUE(SendRtcp1());
1124 EXPECT_TRUE(SendRtcp2()); 1147 EXPECT_TRUE(SendRtcp2());
1125 EXPECT_TRUE(CheckRtp1()); 1148 EXPECT_TRUE(CheckRtp1());
1126 EXPECT_TRUE(CheckRtp2()); 1149 EXPECT_TRUE(CheckRtp2());
1127 EXPECT_TRUE(CheckNoRtp1()); 1150 EXPECT_TRUE(CheckNoRtp1());
1128 EXPECT_TRUE(CheckNoRtp2()); 1151 EXPECT_TRUE(CheckNoRtp2());
1129 EXPECT_TRUE(CheckRtcp1()); 1152 EXPECT_TRUE(CheckRtcp1());
1130 EXPECT_TRUE(CheckRtcp2()); 1153 EXPECT_TRUE(CheckRtcp2());
1131 EXPECT_TRUE(CheckNoRtcp1()); 1154 EXPECT_TRUE(CheckNoRtcp1());
1132 EXPECT_TRUE(CheckNoRtcp2()); 1155 EXPECT_TRUE(CheckNoRtcp2());
1133 } 1156 }
1134 1157
1135 // Check that RTP and RTCP are transmitted ok when both sides 1158 // Check that RTP and RTCP are transmitted ok when both sides
1136 // support mux and one the answerer requires rtcp mux. 1159 // support mux and one the answerer requires rtcp mux.
1137 void SendRtcpMuxToRequireRtcpMux() { 1160 void SendRtcpMuxToRequireRtcpMux() {
1138 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1161 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1139 channel2_->ActivateRtcpMux(); 1162 channel2_->ActivateRtcpMux();
1140 EXPECT_TRUE(SendInitiate()); 1163 EXPECT_TRUE(SendInitiate());
1164 ASSERT_TRUE(GetTransport1());
1165 ASSERT_TRUE(GetTransport2());
1141 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1166 EXPECT_EQ(2U, GetTransport1()->channels().size());
1142 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1167 EXPECT_EQ(1U, GetTransport2()->channels().size());
1143 EXPECT_TRUE(SendAccept()); 1168 EXPECT_TRUE(SendAccept());
1144 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1169 EXPECT_EQ(1U, GetTransport1()->channels().size());
1145 EXPECT_TRUE(SendRtp1()); 1170 EXPECT_TRUE(SendRtp1());
1146 EXPECT_TRUE(SendRtp2()); 1171 EXPECT_TRUE(SendRtp2());
1147 EXPECT_TRUE(SendRtcp1()); 1172 EXPECT_TRUE(SendRtcp1());
1148 EXPECT_TRUE(SendRtcp2()); 1173 EXPECT_TRUE(SendRtcp2());
1149 EXPECT_TRUE(CheckRtp1()); 1174 EXPECT_TRUE(CheckRtp1());
1150 EXPECT_TRUE(CheckRtp2()); 1175 EXPECT_TRUE(CheckRtp2());
1151 EXPECT_TRUE(CheckNoRtp1()); 1176 EXPECT_TRUE(CheckNoRtp1());
1152 EXPECT_TRUE(CheckNoRtp2()); 1177 EXPECT_TRUE(CheckNoRtp2());
1153 EXPECT_TRUE(CheckRtcp1()); 1178 EXPECT_TRUE(CheckRtcp1());
1154 EXPECT_TRUE(CheckRtcp2()); 1179 EXPECT_TRUE(CheckRtcp2());
1155 EXPECT_TRUE(CheckNoRtcp1()); 1180 EXPECT_TRUE(CheckNoRtcp1());
1156 EXPECT_TRUE(CheckNoRtcp2()); 1181 EXPECT_TRUE(CheckNoRtcp2());
1157 } 1182 }
1158 1183
1159 // Check that RTP and RTCP are transmitted ok when both sides 1184 // Check that RTP and RTCP are transmitted ok when both sides
1160 // require mux. 1185 // require mux.
1161 void SendRequireRtcpMuxToRequireRtcpMux() { 1186 void SendRequireRtcpMuxToRequireRtcpMux() {
1162 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1187 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1163 channel1_->ActivateRtcpMux(); 1188 channel1_->ActivateRtcpMux();
1164 channel2_->ActivateRtcpMux(); 1189 channel2_->ActivateRtcpMux();
1165 EXPECT_TRUE(SendInitiate()); 1190 EXPECT_TRUE(SendInitiate());
1191 ASSERT_TRUE(GetTransport1());
1192 ASSERT_TRUE(GetTransport2());
1166 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1193 EXPECT_EQ(1U, GetTransport1()->channels().size());
1167 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1194 EXPECT_EQ(1U, GetTransport2()->channels().size());
1168 EXPECT_TRUE(SendAccept()); 1195 EXPECT_TRUE(SendAccept());
1169 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1196 EXPECT_EQ(1U, GetTransport1()->channels().size());
1170 EXPECT_TRUE(SendRtp1()); 1197 EXPECT_TRUE(SendRtp1());
1171 EXPECT_TRUE(SendRtp2()); 1198 EXPECT_TRUE(SendRtp2());
1172 EXPECT_TRUE(SendRtcp1()); 1199 EXPECT_TRUE(SendRtcp1());
1173 EXPECT_TRUE(SendRtcp2()); 1200 EXPECT_TRUE(SendRtcp2());
1174 EXPECT_TRUE(CheckRtp1()); 1201 EXPECT_TRUE(CheckRtp1());
1175 EXPECT_TRUE(CheckRtp2()); 1202 EXPECT_TRUE(CheckRtp2());
1176 EXPECT_TRUE(CheckNoRtp1()); 1203 EXPECT_TRUE(CheckNoRtp1());
1177 EXPECT_TRUE(CheckNoRtp2()); 1204 EXPECT_TRUE(CheckNoRtp2());
1178 EXPECT_TRUE(CheckRtcp1()); 1205 EXPECT_TRUE(CheckRtcp1());
1179 EXPECT_TRUE(CheckRtcp2()); 1206 EXPECT_TRUE(CheckRtcp2());
1180 EXPECT_TRUE(CheckNoRtcp1()); 1207 EXPECT_TRUE(CheckNoRtcp1());
1181 EXPECT_TRUE(CheckNoRtcp2()); 1208 EXPECT_TRUE(CheckNoRtcp2());
1182 } 1209 }
1183 1210
1184 // Check that SendAccept fails if the answerer doesn't support mux 1211 // Check that SendAccept fails if the answerer doesn't support mux
1185 // and the offerer requires it. 1212 // and the offerer requires it.
1186 void SendRequireRtcpMuxToNoRtcpMux() { 1213 void SendRequireRtcpMuxToNoRtcpMux() {
1187 CreateChannels(RTCP | RTCP_MUX, RTCP); 1214 CreateChannels(RTCP | RTCP_MUX, RTCP);
1188 channel1_->ActivateRtcpMux(); 1215 channel1_->ActivateRtcpMux();
1189 EXPECT_TRUE(SendInitiate()); 1216 EXPECT_TRUE(SendInitiate());
1217 ASSERT_TRUE(GetTransport1());
1218 ASSERT_TRUE(GetTransport2());
1190 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1219 EXPECT_EQ(1U, GetTransport1()->channels().size());
1191 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1220 EXPECT_EQ(2U, GetTransport2()->channels().size());
1192 EXPECT_FALSE(SendAccept()); 1221 EXPECT_FALSE(SendAccept());
1193 } 1222 }
1194 1223
1195 // Check that RTCP data sent by the initiator before the accept is not muxed. 1224 // Check that RTCP data sent by the initiator before the accept is not muxed.
1196 void SendEarlyRtcpMuxToRtcp() { 1225 void SendEarlyRtcpMuxToRtcp() {
1197 CreateChannels(RTCP | RTCP_MUX, RTCP); 1226 CreateChannels(RTCP | RTCP_MUX, RTCP);
1198 EXPECT_TRUE(SendInitiate()); 1227 EXPECT_TRUE(SendInitiate());
1228 ASSERT_TRUE(GetTransport1());
1229 ASSERT_TRUE(GetTransport2());
1199 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1230 EXPECT_EQ(2U, GetTransport1()->channels().size());
1200 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1231 EXPECT_EQ(2U, GetTransport2()->channels().size());
1201 1232
1202 // RTCP can be sent before the call is accepted, if the transport is ready. 1233 // RTCP can be sent before the call is accepted, if the transport is ready.
1203 // It should not be muxed though, as the remote side doesn't support mux. 1234 // It should not be muxed though, as the remote side doesn't support mux.
1204 EXPECT_TRUE(SendRtcp1()); 1235 EXPECT_TRUE(SendRtcp1());
1205 EXPECT_TRUE(CheckNoRtp2()); 1236 EXPECT_TRUE(CheckNoRtp2());
1206 EXPECT_TRUE(CheckRtcp2()); 1237 EXPECT_TRUE(CheckRtcp2());
1207 1238
1208 // Send RTCP packet from callee and verify that it is received. 1239 // Send RTCP packet from callee and verify that it is received.
(...skipping 10 matching lines...) Expand all
1219 EXPECT_TRUE(CheckRtcp1()); 1250 EXPECT_TRUE(CheckRtcp1());
1220 } 1251 }
1221 1252
1222 1253
1223 // Check that RTCP data is not muxed until both sides have enabled muxing, 1254 // Check that RTCP data is not muxed until both sides have enabled muxing,
1224 // but that we properly demux before we get the accept message, since there 1255 // but that we properly demux before we get the accept message, since there
1225 // is a race between RTP data and the jingle accept. 1256 // is a race between RTP data and the jingle accept.
1226 void SendEarlyRtcpMuxToRtcpMux() { 1257 void SendEarlyRtcpMuxToRtcpMux() {
1227 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); 1258 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX);
1228 EXPECT_TRUE(SendInitiate()); 1259 EXPECT_TRUE(SendInitiate());
1260 ASSERT_TRUE(GetTransport1());
1261 ASSERT_TRUE(GetTransport2());
1229 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1262 EXPECT_EQ(2U, GetTransport1()->channels().size());
1230 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1263 EXPECT_EQ(1U, GetTransport2()->channels().size());
1231 1264
1232 // RTCP can't be sent yet, since the RTCP transport isn't writable, and 1265 // RTCP can't be sent yet, since the RTCP transport isn't writable, and
1233 // we haven't yet received the accept that says we should mux. 1266 // we haven't yet received the accept that says we should mux.
1234 EXPECT_FALSE(SendRtcp1()); 1267 EXPECT_FALSE(SendRtcp1());
1235 1268
1236 // Send muxed RTCP packet from callee and verify that it is received. 1269 // Send muxed RTCP packet from callee and verify that it is received.
1237 EXPECT_TRUE(SendRtcp2()); 1270 EXPECT_TRUE(SendRtcp2());
1238 EXPECT_TRUE(CheckNoRtp1()); 1271 EXPECT_TRUE(CheckNoRtp1());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. 1342 // sent and received. The test uses SRTP, RTCP mux and SSRC mux.
1310 void SendEarlyMediaUsingRtcpMuxSrtp() { 1343 void SendEarlyMediaUsingRtcpMuxSrtp() {
1311 int sequence_number1_1 = 0, sequence_number2_2 = 0; 1344 int sequence_number1_1 = 0, sequence_number2_2 = 0;
1312 1345
1313 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, 1346 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE,
1314 SSRC_MUX | RTCP | RTCP_MUX | SECURE); 1347 SSRC_MUX | RTCP | RTCP_MUX | SECURE);
1315 EXPECT_TRUE(SendOffer()); 1348 EXPECT_TRUE(SendOffer());
1316 EXPECT_TRUE(SendProvisionalAnswer()); 1349 EXPECT_TRUE(SendProvisionalAnswer());
1317 EXPECT_TRUE(channel1_->secure()); 1350 EXPECT_TRUE(channel1_->secure());
1318 EXPECT_TRUE(channel2_->secure()); 1351 EXPECT_TRUE(channel2_->secure());
1352 ASSERT_TRUE(GetTransport1());
1353 ASSERT_TRUE(GetTransport2());
1319 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1354 EXPECT_EQ(2U, GetTransport1()->channels().size());
1320 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1355 EXPECT_EQ(2U, GetTransport2()->channels().size());
1321 EXPECT_TRUE(SendCustomRtcp1(kSsrc1)); 1356 EXPECT_TRUE(SendCustomRtcp1(kSsrc1));
1322 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); 1357 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1));
1323 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1)); 1358 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1));
1324 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); 1359 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1));
1325 1360
1326 // Send packets from callee and verify that it is received. 1361 // Send packets from callee and verify that it is received.
1327 EXPECT_TRUE(SendCustomRtcp2(kSsrc2)); 1362 EXPECT_TRUE(SendCustomRtcp2(kSsrc2));
1328 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); 1363 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 EXPECT_TRUE(CheckNoRtcp1()); 1427 EXPECT_TRUE(CheckNoRtcp1());
1393 EXPECT_TRUE(CheckNoRtcp2()); 1428 EXPECT_TRUE(CheckNoRtcp2());
1394 } 1429 }
1395 1430
1396 // Test that the mediachannel retains its sending state after the transport 1431 // Test that the mediachannel retains its sending state after the transport
1397 // becomes non-writable. 1432 // becomes non-writable.
1398 void SendWithWritabilityLoss() { 1433 void SendWithWritabilityLoss() {
1399 CreateChannels(0, 0); 1434 CreateChannels(0, 0);
1400 EXPECT_TRUE(SendInitiate()); 1435 EXPECT_TRUE(SendInitiate());
1401 EXPECT_TRUE(SendAccept()); 1436 EXPECT_TRUE(SendAccept());
1437 ASSERT_TRUE(GetTransport1());
1438 ASSERT_TRUE(GetTransport2());
1402 EXPECT_EQ(1U, GetTransport1()->channels().size()); 1439 EXPECT_EQ(1U, GetTransport1()->channels().size());
1403 EXPECT_EQ(1U, GetTransport2()->channels().size()); 1440 EXPECT_EQ(1U, GetTransport2()->channels().size());
1404 EXPECT_TRUE(SendRtp1()); 1441 EXPECT_TRUE(SendRtp1());
1405 EXPECT_TRUE(SendRtp2()); 1442 EXPECT_TRUE(SendRtp2());
1406 EXPECT_TRUE(CheckRtp1()); 1443 EXPECT_TRUE(CheckRtp1());
1407 EXPECT_TRUE(CheckRtp2()); 1444 EXPECT_TRUE(CheckRtp2());
1408 EXPECT_TRUE(CheckNoRtp1()); 1445 EXPECT_TRUE(CheckNoRtp1());
1409 EXPECT_TRUE(CheckNoRtp2()); 1446 EXPECT_TRUE(CheckNoRtp2());
1410 1447
1411 // Lose writability, which should fail. 1448 // Lose writability, which should fail.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 int pl_type2 = pl_types[1]; 1493 int pl_type2 = pl_types[1];
1457 int flags = SSRC_MUX | RTCP; 1494 int flags = SSRC_MUX | RTCP;
1458 if (secure) flags |= SECURE; 1495 if (secure) flags |= SECURE;
1459 uint32 expected_channels = 2U; 1496 uint32 expected_channels = 2U;
1460 if (rtcp_mux) { 1497 if (rtcp_mux) {
1461 flags |= RTCP_MUX; 1498 flags |= RTCP_MUX;
1462 expected_channels = 1U; 1499 expected_channels = 1U;
1463 } 1500 }
1464 CreateChannels(flags, flags); 1501 CreateChannels(flags, flags);
1465 EXPECT_TRUE(SendInitiate()); 1502 EXPECT_TRUE(SendInitiate());
1503 ASSERT_TRUE(GetTransport1());
1504 ASSERT_TRUE(GetTransport2());
1466 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1505 EXPECT_EQ(2U, GetTransport1()->channels().size());
1467 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); 1506 EXPECT_EQ(expected_channels, GetTransport2()->channels().size());
1468 EXPECT_TRUE(SendAccept()); 1507 EXPECT_TRUE(SendAccept());
1469 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); 1508 EXPECT_EQ(expected_channels, GetTransport1()->channels().size());
1470 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); 1509 EXPECT_EQ(expected_channels, GetTransport2()->channels().size());
1471 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); 1510 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1));
1472 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); 1511 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1));
1473 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); 1512 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2));
1474 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); 1513 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2));
1475 // channel1 - should only have media_content2 as remote. i.e. kSsrc2 1514 // channel1 - should only have media_content2 as remote. i.e. kSsrc2
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); 1683 EXPECT_FALSE(media_channel1_->HasRecvStream(2));
1645 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); 1684 EXPECT_TRUE(media_channel1_->HasRecvStream(3));
1646 } 1685 }
1647 1686
1648 void TestFlushRtcp() { 1687 void TestFlushRtcp() {
1649 bool send_rtcp1; 1688 bool send_rtcp1;
1650 1689
1651 CreateChannels(RTCP, RTCP); 1690 CreateChannels(RTCP, RTCP);
1652 EXPECT_TRUE(SendInitiate()); 1691 EXPECT_TRUE(SendInitiate());
1653 EXPECT_TRUE(SendAccept()); 1692 EXPECT_TRUE(SendAccept());
1693 ASSERT_TRUE(GetTransport1());
1694 ASSERT_TRUE(GetTransport2());
1654 EXPECT_EQ(2U, GetTransport1()->channels().size()); 1695 EXPECT_EQ(2U, GetTransport1()->channels().size());
1655 EXPECT_EQ(2U, GetTransport2()->channels().size()); 1696 EXPECT_EQ(2U, GetTransport2()->channels().size());
1656 1697
1657 // Send RTCP1 from a different thread. 1698 // Send RTCP1 from a different thread.
1658 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1); 1699 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1);
1659 EXPECT_TRUE(send_rtcp1); 1700 EXPECT_TRUE(send_rtcp1);
1660 // The sending message is only posted. channel2_ should be empty. 1701 // The sending message is only posted. channel2_ should be empty.
1661 EXPECT_TRUE(CheckNoRtcp2()); 1702 EXPECT_TRUE(CheckNoRtcp2());
1662 1703
1663 // When channel1_ is deleted, the RTCP packet should be sent out to 1704 // When channel1_ is deleted, the RTCP packet should be sent out to
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); 1773 TransportChannel* rtcp = channel1_->rtcp_transport_channel();
1733 EXPECT_FALSE(media_channel1_->ready_to_send()); 1774 EXPECT_FALSE(media_channel1_->ready_to_send());
1734 rtp->SignalReadyToSend(rtp); 1775 rtp->SignalReadyToSend(rtp);
1735 EXPECT_FALSE(media_channel1_->ready_to_send()); 1776 EXPECT_FALSE(media_channel1_->ready_to_send());
1736 rtcp->SignalReadyToSend(rtcp); 1777 rtcp->SignalReadyToSend(rtcp);
1737 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp 1778 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp
1738 // channel are ready to send. 1779 // channel are ready to send.
1739 EXPECT_TRUE(media_channel1_->ready_to_send()); 1780 EXPECT_TRUE(media_channel1_->ready_to_send());
1740 1781
1741 // rtp channel becomes not ready to send will be propagated to mediachannel 1782 // rtp channel becomes not ready to send will be propagated to mediachannel
1742 channel1_->SetReadyToSend(rtp, false); 1783 channel1_->SetReadyToSend(false, false);
1743 EXPECT_FALSE(media_channel1_->ready_to_send()); 1784 EXPECT_FALSE(media_channel1_->ready_to_send());
1744 channel1_->SetReadyToSend(rtp, true); 1785 channel1_->SetReadyToSend(false, true);
1745 EXPECT_TRUE(media_channel1_->ready_to_send()); 1786 EXPECT_TRUE(media_channel1_->ready_to_send());
1746 1787
1747 // rtcp channel becomes not ready to send will be propagated to mediachannel 1788 // rtcp channel becomes not ready to send will be propagated to mediachannel
1748 channel1_->SetReadyToSend(rtcp, false); 1789 channel1_->SetReadyToSend(true, false);
1749 EXPECT_FALSE(media_channel1_->ready_to_send()); 1790 EXPECT_FALSE(media_channel1_->ready_to_send());
1750 channel1_->SetReadyToSend(rtcp, true); 1791 channel1_->SetReadyToSend(true, true);
1751 EXPECT_TRUE(media_channel1_->ready_to_send()); 1792 EXPECT_TRUE(media_channel1_->ready_to_send());
1752 } 1793 }
1753 1794
1754 void TestOnReadyToSendWithRtcpMux() { 1795 void TestOnReadyToSendWithRtcpMux() {
1755 CreateChannels(RTCP, RTCP); 1796 CreateChannels(RTCP, RTCP);
1756 typename T::Content content; 1797 typename T::Content content;
1757 CreateContent(0, kPcmuCodec, kH264Codec, &content); 1798 CreateContent(0, kPcmuCodec, kH264Codec, &content);
1758 // Both sides agree on mux. Should no longer be a separate RTCP channel. 1799 // Both sides agree on mux. Should no longer be a separate RTCP channel.
1759 content.set_rtcp_mux(true); 1800 content.set_rtcp_mux(true);
1760 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); 1801 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL));
1761 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); 1802 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL));
1762 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); 1803 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL);
1763 TransportChannel* rtp = channel1_->transport_channel(); 1804 TransportChannel* rtp = channel1_->transport_channel();
1764 EXPECT_FALSE(media_channel1_->ready_to_send()); 1805 EXPECT_FALSE(media_channel1_->ready_to_send());
1765 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel 1806 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel
1766 // should trigger the MediaChannel's OnReadyToSend. 1807 // should trigger the MediaChannel's OnReadyToSend.
1767 rtp->SignalReadyToSend(rtp); 1808 rtp->SignalReadyToSend(rtp);
1768 EXPECT_TRUE(media_channel1_->ready_to_send()); 1809 EXPECT_TRUE(media_channel1_->ready_to_send());
1769 channel1_->SetReadyToSend(rtp, false); 1810 channel1_->SetReadyToSend(false, false);
1770 EXPECT_FALSE(media_channel1_->ready_to_send()); 1811 EXPECT_FALSE(media_channel1_->ready_to_send());
1771 } 1812 }
1772 1813
1773 protected: 1814 protected:
1774 cricket::FakeSession session1_; 1815 cricket::FakeTransportController transport_controller1_;
1775 cricket::FakeSession session2_; 1816 cricket::FakeTransportController transport_controller2_;
1776 cricket::FakeMediaEngine media_engine_; 1817 cricket::FakeMediaEngine media_engine_;
1777 // The media channels are owned by the voice channel objects below. 1818 // The media channels are owned by the voice channel objects below.
1778 typename T::MediaChannel* media_channel1_; 1819 typename T::MediaChannel* media_channel1_;
1779 typename T::MediaChannel* media_channel2_; 1820 typename T::MediaChannel* media_channel2_;
1780 rtc::scoped_ptr<typename T::Channel> channel1_; 1821 rtc::scoped_ptr<typename T::Channel> channel1_;
1781 rtc::scoped_ptr<typename T::Channel> channel2_; 1822 rtc::scoped_ptr<typename T::Channel> channel2_;
1782 typename T::Content local_media_content1_; 1823 typename T::Content local_media_content1_;
1783 typename T::Content local_media_content2_; 1824 typename T::Content local_media_content2_;
1784 typename T::Content remote_media_content1_; 1825 typename T::Content remote_media_content1_;
1785 typename T::Content remote_media_content2_; 1826 typename T::Content remote_media_content2_;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 channel1_->SetChannelOptions(options2); 1898 channel1_->SetChannelOptions(options2);
1858 channel2_->SetChannelOptions(options2); 1899 channel2_->SetChannelOptions(options2);
1859 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options)); 1900 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options));
1860 EXPECT_EQ(options2, actual_options); 1901 EXPECT_EQ(options2, actual_options);
1861 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options)); 1902 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options));
1862 EXPECT_EQ(options2, actual_options); 1903 EXPECT_EQ(options2, actual_options);
1863 } 1904 }
1864 }; 1905 };
1865 1906
1866 // override to add NULL parameter 1907 // override to add NULL parameter
1867 template<> 1908 template <>
1868 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( 1909 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel(
1869 rtc::Thread* thread, cricket::MediaEngineInterface* engine, 1910 rtc::Thread* thread,
1870 cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session, 1911 cricket::MediaEngineInterface* engine,
1912 cricket::FakeVideoMediaChannel* ch,
1913 cricket::TransportController* transport_controller,
1871 bool rtcp) { 1914 bool rtcp) {
1872 cricket::VideoChannel* channel = new cricket::VideoChannel( 1915 cricket::VideoChannel* channel = new cricket::VideoChannel(
1873 thread, ch, session, cricket::CN_VIDEO, rtcp); 1916 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp);
1874 if (!channel->Init()) { 1917 if (!channel->Init()) {
1875 delete channel; 1918 delete channel;
1876 channel = NULL; 1919 channel = NULL;
1877 } 1920 }
1878 return channel; 1921 return channel;
1879 } 1922 }
1880 1923
1881 // override to add 0 parameter 1924 // override to add 0 parameter
1882 template<> 1925 template<>
1883 bool ChannelTest<VideoTraits>::AddStream1(int id) { 1926 bool ChannelTest<VideoTraits>::AddStream1(int id) {
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 : public ChannelTest<DataTraits> { 2687 : public ChannelTest<DataTraits> {
2645 public: 2688 public:
2646 typedef ChannelTest<DataTraits> 2689 typedef ChannelTest<DataTraits>
2647 Base; 2690 Base;
2648 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), 2691 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket),
2649 kRtcpReport, sizeof(kRtcpReport)) { 2692 kRtcpReport, sizeof(kRtcpReport)) {
2650 } 2693 }
2651 }; 2694 };
2652 2695
2653 // Override to avoid engine channel parameter. 2696 // Override to avoid engine channel parameter.
2654 template<> 2697 template <>
2655 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( 2698 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel(
2656 rtc::Thread* thread, cricket::MediaEngineInterface* engine, 2699 rtc::Thread* thread,
2657 cricket::FakeDataMediaChannel* ch, cricket::BaseSession* session, 2700 cricket::MediaEngineInterface* engine,
2701 cricket::FakeDataMediaChannel* ch,
2702 cricket::TransportController* transport_controller,
2658 bool rtcp) { 2703 bool rtcp) {
2659 cricket::DataChannel* channel = new cricket::DataChannel( 2704 cricket::DataChannel* channel = new cricket::DataChannel(
2660 thread, ch, session, cricket::CN_DATA, rtcp); 2705 thread, ch, transport_controller, cricket::CN_DATA, rtcp);
2661 if (!channel->Init()) { 2706 if (!channel->Init()) {
2662 delete channel; 2707 delete channel;
2663 channel = NULL; 2708 channel = NULL;
2664 } 2709 }
2665 return channel; 2710 return channel;
2666 } 2711 }
2667 2712
2668 template<> 2713 template<>
2669 void ChannelTest<DataTraits>::CreateContent( 2714 void ChannelTest<DataTraits>::CreateContent(
2670 int flags, 2715 int flags,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 }; 2881 };
2837 rtc::Buffer payload(data, 3); 2882 rtc::Buffer payload(data, 3);
2838 cricket::SendDataResult result; 2883 cricket::SendDataResult result;
2839 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2884 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2840 EXPECT_EQ(params.ssrc, 2885 EXPECT_EQ(params.ssrc,
2841 media_channel1_->last_sent_data_params().ssrc); 2886 media_channel1_->last_sent_data_params().ssrc);
2842 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2887 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2843 } 2888 }
2844 2889
2845 // TODO(pthatcher): TestSetReceiver? 2890 // TODO(pthatcher): TestSetReceiver?
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698