OLD | NEW |
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 Loading... |
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 "talk/session/media/typingmonitor.h" | 38 #include "talk/session/media/typingmonitor.h" |
39 #include "webrtc/base/fileutils.h" | 39 #include "webrtc/base/fileutils.h" |
40 #include "webrtc/base/gunit.h" | 40 #include "webrtc/base/gunit.h" |
41 #include "webrtc/base/helpers.h" | 41 #include "webrtc/base/helpers.h" |
42 #include "webrtc/base/logging.h" | 42 #include "webrtc/base/logging.h" |
43 #include "webrtc/base/pathutils.h" | 43 #include "webrtc/base/pathutils.h" |
44 #include "webrtc/base/signalthread.h" | 44 #include "webrtc/base/signalthread.h" |
45 #include "webrtc/base/ssladapter.h" | 45 #include "webrtc/base/ssladapter.h" |
46 #include "webrtc/base/sslidentity.h" | 46 #include "webrtc/base/sslidentity.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 rtc::Pathname(path), "wb"); | 119 rtc::Pathname(path), "wb"); |
120 } | 120 } |
121 | 121 |
122 // Base class for Voice/VideoChannel tests | 122 // Base class for Voice/VideoChannel tests |
123 template<class T> | 123 template<class T> |
124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
125 public: | 125 public: |
126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
127 DTLS = 0x10 }; | 127 DTLS = 0x10 }; |
128 | 128 |
129 ChannelTest(const uint8* rtp_data, int rtp_len, | 129 ChannelTest(const uint8* rtp_data, |
130 const uint8* rtcp_data, int rtcp_len) | 130 int rtp_len, |
131 : session1_(true), | 131 const uint8* rtcp_data, |
132 session2_(false), | 132 int rtcp_len) |
| 133 : transport_controller1_(true), |
| 134 transport_controller2_(false), |
133 media_channel1_(NULL), | 135 media_channel1_(NULL), |
134 media_channel2_(NULL), | 136 media_channel2_(NULL), |
135 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 137 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), |
136 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 138 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), |
137 media_info_callbacks1_(), | 139 media_info_callbacks1_(), |
138 media_info_callbacks2_(), | 140 media_info_callbacks2_(), |
139 mute_callback_recved_(false), | 141 mute_callback_recved_(false), |
140 mute_callback_value_(false), | 142 mute_callback_value_(false), |
141 ssrc_(0), | 143 ssrc_(0), |
142 error_(T::MediaChannel::ERROR_NONE) { | 144 error_(T::MediaChannel::ERROR_NONE) {} |
143 } | |
144 | 145 |
145 void CreateChannels(int flags1, int flags2) { | 146 void CreateChannels(int flags1, int flags2) { |
146 CreateChannels(new typename T::MediaChannel(NULL), | 147 CreateChannels(new typename T::MediaChannel(NULL), |
147 new typename T::MediaChannel(NULL), | 148 new typename T::MediaChannel(NULL), |
148 flags1, flags2, rtc::Thread::Current()); | 149 flags1, flags2, rtc::Thread::Current()); |
149 } | 150 } |
150 void CreateChannels(int flags) { | 151 void CreateChannels(int flags) { |
151 CreateChannels(new typename T::MediaChannel(NULL), | 152 CreateChannels(new typename T::MediaChannel(NULL), |
152 new typename T::MediaChannel(NULL), | 153 new typename T::MediaChannel(NULL), |
153 flags, rtc::Thread::Current()); | 154 flags, rtc::Thread::Current()); |
154 } | 155 } |
155 void CreateChannels(int flags1, int flags2, | 156 void CreateChannels(int flags1, int flags2, |
156 rtc::Thread* thread) { | 157 rtc::Thread* thread) { |
157 CreateChannels(new typename T::MediaChannel(NULL), | 158 CreateChannels(new typename T::MediaChannel(NULL), |
158 new typename T::MediaChannel(NULL), | 159 new typename T::MediaChannel(NULL), |
159 flags1, flags2, thread); | 160 flags1, flags2, thread); |
160 } | 161 } |
161 void CreateChannels(int flags, | 162 void CreateChannels(int flags, |
162 rtc::Thread* thread) { | 163 rtc::Thread* thread) { |
163 CreateChannels(new typename T::MediaChannel(NULL), | 164 CreateChannels(new typename T::MediaChannel(NULL), |
164 new typename T::MediaChannel(NULL), | 165 new typename T::MediaChannel(NULL), |
165 flags, thread); | 166 flags, thread); |
166 } | 167 } |
167 void CreateChannels( | 168 void CreateChannels( |
168 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 169 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, |
169 int flags1, int flags2, rtc::Thread* thread) { | 170 int flags1, int flags2, rtc::Thread* thread) { |
170 media_channel1_ = ch1; | 171 media_channel1_ = ch1; |
171 media_channel2_ = ch2; | 172 media_channel2_ = ch2; |
172 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_, | 173 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, |
| 174 &transport_controller1_, |
173 (flags1 & RTCP) != 0)); | 175 (flags1 & RTCP) != 0)); |
174 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session2_, | 176 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, |
| 177 &transport_controller2_, |
175 (flags2 & RTCP) != 0)); | 178 (flags2 & RTCP) != 0)); |
176 channel1_->SignalMediaMonitor.connect( | 179 channel1_->SignalMediaMonitor.connect( |
177 this, &ChannelTest<T>::OnMediaMonitor); | 180 this, &ChannelTest<T>::OnMediaMonitor); |
178 channel2_->SignalMediaMonitor.connect( | 181 channel2_->SignalMediaMonitor.connect( |
179 this, &ChannelTest<T>::OnMediaMonitor); | 182 this, &ChannelTest<T>::OnMediaMonitor); |
180 channel1_->SignalMediaError.connect( | 183 channel1_->SignalMediaError.connect( |
181 this, &ChannelTest<T>::OnMediaChannelError); | 184 this, &ChannelTest<T>::OnMediaChannelError); |
182 channel2_->SignalMediaError.connect( | 185 channel2_->SignalMediaError.connect( |
183 this, &ChannelTest<T>::OnMediaChannelError); | 186 this, &ChannelTest<T>::OnMediaChannelError); |
184 channel1_->SignalAutoMuted.connect( | 187 channel1_->SignalAutoMuted.connect( |
185 this, &ChannelTest<T>::OnMediaMuted); | 188 this, &ChannelTest<T>::OnMediaMuted); |
186 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 189 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
187 flags1 = (flags1 & ~SECURE); | 190 flags1 = (flags1 & ~SECURE); |
188 flags2 = (flags2 & ~SECURE); | 191 flags2 = (flags2 & ~SECURE); |
189 } | 192 } |
190 CreateContent(flags1, kPcmuCodec, kH264Codec, | 193 CreateContent(flags1, kPcmuCodec, kH264Codec, |
191 &local_media_content1_); | 194 &local_media_content1_); |
192 CreateContent(flags2, kPcmuCodec, kH264Codec, | 195 CreateContent(flags2, kPcmuCodec, kH264Codec, |
193 &local_media_content2_); | 196 &local_media_content2_); |
194 CopyContent(local_media_content1_, &remote_media_content1_); | 197 CopyContent(local_media_content1_, &remote_media_content1_); |
195 CopyContent(local_media_content2_, &remote_media_content2_); | 198 CopyContent(local_media_content2_, &remote_media_content2_); |
196 | 199 |
197 if (flags1 & DTLS) { | 200 if (flags1 & DTLS) { |
198 // Confirmed to work with KT_RSA and KT_ECDSA. | 201 // Confirmed to work with KT_RSA and KT_ECDSA. |
199 session1_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( | 202 transport_controller1_.SetCertificate(rtc::RTCCertificate::Create( |
200 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( | 203 rtc::scoped_ptr<rtc::SSLIdentity>( |
201 "session1", rtc::KT_DEFAULT)).Pass())); | 204 rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)).Pass())); |
202 } | 205 } |
203 if (flags2 & DTLS) { | 206 if (flags2 & DTLS) { |
204 // Confirmed to work with KT_RSA and KT_ECDSA. | 207 // Confirmed to work with KT_RSA and KT_ECDSA. |
205 session2_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( | 208 transport_controller2_.SetCertificate(rtc::RTCCertificate::Create( |
206 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( | 209 rtc::scoped_ptr<rtc::SSLIdentity>( |
207 "session2", rtc::KT_DEFAULT)).Pass())); | 210 rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)).Pass())); |
208 } | 211 } |
209 | 212 |
210 // Add stream information (SSRC) to the local content but not to the remote | 213 // Add stream information (SSRC) to the local content but not to the remote |
211 // content. This means that we per default know the SSRC of what we send but | 214 // content. This means that we per default know the SSRC of what we send but |
212 // not what we receive. | 215 // not what we receive. |
213 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); | 216 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); |
214 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); | 217 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); |
215 | 218 |
216 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. | 219 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. |
217 if (flags1 & SSRC_MUX) { | 220 if (flags1 & SSRC_MUX) { |
218 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); | 221 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); |
219 } | 222 } |
220 if (flags2 & SSRC_MUX) { | 223 if (flags2 & SSRC_MUX) { |
221 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 224 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
222 } | 225 } |
223 } | 226 } |
224 | 227 |
225 void CreateChannels( | 228 void CreateChannels( |
226 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 229 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, |
227 int flags, rtc::Thread* thread) { | 230 int flags, rtc::Thread* thread) { |
228 media_channel1_ = ch1; | 231 media_channel1_ = ch1; |
229 media_channel2_ = ch2; | 232 media_channel2_ = ch2; |
230 | 233 |
231 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_, | 234 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, |
| 235 &transport_controller1_, |
232 (flags & RTCP) != 0)); | 236 (flags & RTCP) != 0)); |
233 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session1_, | 237 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, |
| 238 &transport_controller1_, |
234 (flags & RTCP) != 0)); | 239 (flags & RTCP) != 0)); |
235 channel1_->SignalMediaMonitor.connect( | 240 channel1_->SignalMediaMonitor.connect( |
236 this, &ChannelTest<T>::OnMediaMonitor); | 241 this, &ChannelTest<T>::OnMediaMonitor); |
237 channel2_->SignalMediaMonitor.connect( | 242 channel2_->SignalMediaMonitor.connect( |
238 this, &ChannelTest<T>::OnMediaMonitor); | 243 this, &ChannelTest<T>::OnMediaMonitor); |
239 channel2_->SignalMediaError.connect( | 244 channel2_->SignalMediaError.connect( |
240 this, &ChannelTest<T>::OnMediaChannelError); | 245 this, &ChannelTest<T>::OnMediaChannelError); |
241 CreateContent(flags, kPcmuCodec, kH264Codec, | 246 CreateContent(flags, kPcmuCodec, kH264Codec, |
242 &local_media_content1_); | 247 &local_media_content1_); |
243 CreateContent(flags, kPcmuCodec, kH264Codec, | 248 CreateContent(flags, kPcmuCodec, kH264Codec, |
244 &local_media_content2_); | 249 &local_media_content2_); |
245 CopyContent(local_media_content1_, &remote_media_content1_); | 250 CopyContent(local_media_content1_, &remote_media_content1_); |
246 CopyContent(local_media_content2_, &remote_media_content2_); | 251 CopyContent(local_media_content2_, &remote_media_content2_); |
247 // Add stream information (SSRC) to the local content but not to the remote | 252 // Add stream information (SSRC) to the local content but not to the remote |
248 // content. This means that we per default know the SSRC of what we send but | 253 // content. This means that we per default know the SSRC of what we send but |
249 // not what we receive. | 254 // not what we receive. |
250 AddLegacyStreamInContent(kSsrc1, flags, &local_media_content1_); | 255 AddLegacyStreamInContent(kSsrc1, flags, &local_media_content1_); |
251 AddLegacyStreamInContent(kSsrc2, flags, &local_media_content2_); | 256 AddLegacyStreamInContent(kSsrc2, flags, &local_media_content2_); |
252 | 257 |
253 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. | 258 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. |
254 if (flags & SSRC_MUX) { | 259 if (flags & SSRC_MUX) { |
255 AddLegacyStreamInContent(kSsrc1, flags, &remote_media_content1_); | 260 AddLegacyStreamInContent(kSsrc1, flags, &remote_media_content1_); |
256 AddLegacyStreamInContent(kSsrc2, flags, &remote_media_content2_); | 261 AddLegacyStreamInContent(kSsrc2, flags, &remote_media_content2_); |
257 } | 262 } |
258 } | 263 } |
259 | 264 |
260 typename T::Channel* CreateChannel(rtc::Thread* thread, | 265 typename T::Channel* CreateChannel( |
261 cricket::MediaEngineInterface* engine, | 266 rtc::Thread* thread, |
262 typename T::MediaChannel* ch, | 267 cricket::MediaEngineInterface* engine, |
263 cricket::BaseSession* session, | 268 typename T::MediaChannel* ch, |
264 bool rtcp) { | 269 cricket::TransportController* transport_controller, |
| 270 bool rtcp) { |
265 typename T::Channel* channel = new typename T::Channel( | 271 typename T::Channel* channel = new typename T::Channel( |
266 thread, engine, ch, session, cricket::CN_AUDIO, rtcp); | 272 thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp); |
267 if (!channel->Init()) { | 273 if (!channel->Init()) { |
268 delete channel; | 274 delete channel; |
269 channel = NULL; | 275 channel = NULL; |
270 } | 276 } |
271 return channel; | 277 return channel; |
272 } | 278 } |
273 | 279 |
274 bool SendInitiate() { | 280 bool SendInitiate() { |
275 bool result = channel1_->SetLocalContent(&local_media_content1_, | 281 bool result = channel1_->SetLocalContent(&local_media_content1_, |
276 CA_OFFER, NULL); | 282 CA_OFFER, NULL); |
277 if (result) { | 283 if (result) { |
278 channel1_->Enable(true); | 284 channel1_->Enable(true); |
279 result = channel2_->SetRemoteContent(&remote_media_content1_, | 285 result = channel2_->SetRemoteContent(&remote_media_content1_, |
280 CA_OFFER, NULL); | 286 CA_OFFER, NULL); |
281 if (result) { | 287 if (result) { |
282 session1_.Connect(&session2_); | 288 transport_controller1_.Connect(&transport_controller2_); |
283 | 289 |
284 result = channel2_->SetLocalContent(&local_media_content2_, | 290 result = channel2_->SetLocalContent(&local_media_content2_, |
285 CA_ANSWER, NULL); | 291 CA_ANSWER, NULL); |
286 } | 292 } |
287 } | 293 } |
288 return result; | 294 return result; |
289 } | 295 } |
290 | 296 |
291 bool SendAccept() { | 297 bool SendAccept() { |
292 channel2_->Enable(true); | 298 channel2_->Enable(true); |
(...skipping 12 matching lines...) Expand all Loading... |
305 return result; | 311 return result; |
306 } | 312 } |
307 | 313 |
308 bool SendProvisionalAnswer() { | 314 bool SendProvisionalAnswer() { |
309 bool result = channel2_->SetLocalContent(&local_media_content2_, | 315 bool result = channel2_->SetLocalContent(&local_media_content2_, |
310 CA_PRANSWER, NULL); | 316 CA_PRANSWER, NULL); |
311 if (result) { | 317 if (result) { |
312 channel2_->Enable(true); | 318 channel2_->Enable(true); |
313 result = channel1_->SetRemoteContent(&remote_media_content2_, | 319 result = channel1_->SetRemoteContent(&remote_media_content2_, |
314 CA_PRANSWER, NULL); | 320 CA_PRANSWER, NULL); |
315 session1_.Connect(&session2_); | 321 transport_controller1_.Connect(&transport_controller2_); |
316 } | 322 } |
317 return result; | 323 return result; |
318 } | 324 } |
319 | 325 |
320 bool SendFinalAnswer() { | 326 bool SendFinalAnswer() { |
321 bool result = channel2_->SetLocalContent(&local_media_content2_, | 327 bool result = channel2_->SetLocalContent(&local_media_content2_, |
322 CA_ANSWER, NULL); | 328 CA_ANSWER, NULL); |
323 if (result) | 329 if (result) |
324 result = channel1_->SetRemoteContent(&remote_media_content2_, | 330 result = channel1_->SetRemoteContent(&remote_media_content2_, |
325 CA_ANSWER, NULL); | 331 CA_ANSWER, NULL); |
326 return result; | 332 return result; |
327 } | 333 } |
328 | 334 |
329 bool SendTerminate() { | 335 bool SendTerminate() { |
330 channel1_.reset(); | 336 channel1_.reset(); |
331 channel2_.reset(); | 337 channel2_.reset(); |
332 return true; | 338 return true; |
333 } | 339 } |
334 | 340 |
335 bool AddStream1(int id) { | 341 bool AddStream1(int id) { |
336 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 342 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
337 } | 343 } |
338 bool RemoveStream1(int id) { | 344 bool RemoveStream1(int id) { |
339 return channel1_->RemoveRecvStream(id); | 345 return channel1_->RemoveRecvStream(id); |
340 } | 346 } |
341 | 347 |
| 348 // Calling "_w" method here is ok since we only use one thread for this test |
342 cricket::FakeTransport* GetTransport1() { | 349 cricket::FakeTransport* GetTransport1() { |
343 return session1_.GetTransport(channel1_->content_name()); | 350 return transport_controller1_.GetTransport_w(channel1_->content_name()); |
344 } | 351 } |
345 cricket::FakeTransport* GetTransport2() { | 352 cricket::FakeTransport* GetTransport2() { |
346 return session2_.GetTransport(channel2_->content_name()); | 353 return transport_controller2_.GetTransport_w(channel2_->content_name()); |
347 } | 354 } |
348 | 355 |
349 bool SendRtp1() { | 356 bool SendRtp1() { |
350 return media_channel1_->SendRtp(rtp_packet_.c_str(), | 357 return media_channel1_->SendRtp(rtp_packet_.c_str(), |
351 static_cast<int>(rtp_packet_.size())); | 358 static_cast<int>(rtp_packet_.size())); |
352 } | 359 } |
353 bool SendRtp2() { | 360 bool SendRtp2() { |
354 return media_channel2_->SendRtp(rtp_packet_.c_str(), | 361 return media_channel2_->SendRtp(rtp_packet_.c_str(), |
355 static_cast<int>(rtp_packet_.size())); | 362 static_cast<int>(rtp_packet_.size())); |
356 } | 363 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 CreateChannels(0, 0); | 827 CreateChannels(0, 0); |
821 typename T::Content content1; | 828 typename T::Content content1; |
822 CreateContent(0, kPcmuCodec, kH264Codec, &content1); | 829 CreateContent(0, kPcmuCodec, kH264Codec, &content1); |
823 content1.AddStream(stream1); | 830 content1.AddStream(stream1); |
824 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 831 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
825 EXPECT_TRUE(channel1_->Enable(true)); | 832 EXPECT_TRUE(channel1_->Enable(true)); |
826 EXPECT_EQ(1u, media_channel1_->send_streams().size()); | 833 EXPECT_EQ(1u, media_channel1_->send_streams().size()); |
827 | 834 |
828 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 835 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
829 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); | 836 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); |
830 session1_.Connect(&session2_); | 837 transport_controller1_.Connect(&transport_controller2_); |
831 | 838 |
832 // Channel 2 do not send anything. | 839 // Channel 2 do not send anything. |
833 typename T::Content content2; | 840 typename T::Content content2; |
834 CreateContent(0, kPcmuCodec, kH264Codec, &content2); | 841 CreateContent(0, kPcmuCodec, kH264Codec, &content2); |
835 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); | 842 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); |
836 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); | 843 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); |
837 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); | 844 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); |
838 EXPECT_TRUE(channel2_->Enable(true)); | 845 EXPECT_TRUE(channel2_->Enable(true)); |
839 EXPECT_EQ(0u, media_channel2_->send_streams().size()); | 846 EXPECT_EQ(0u, media_channel2_->send_streams().size()); |
840 | 847 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 EXPECT_TRUE(media_channel1_->playout()); | 890 EXPECT_TRUE(media_channel1_->playout()); |
884 EXPECT_FALSE(media_channel1_->sending()); | 891 EXPECT_FALSE(media_channel1_->sending()); |
885 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, | 892 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, |
886 CA_OFFER, NULL)); | 893 CA_OFFER, NULL)); |
887 EXPECT_FALSE(media_channel2_->playout()); | 894 EXPECT_FALSE(media_channel2_->playout()); |
888 EXPECT_FALSE(media_channel2_->sending()); | 895 EXPECT_FALSE(media_channel2_->sending()); |
889 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, | 896 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, |
890 CA_ANSWER, NULL)); | 897 CA_ANSWER, NULL)); |
891 EXPECT_FALSE(media_channel2_->playout()); | 898 EXPECT_FALSE(media_channel2_->playout()); |
892 EXPECT_FALSE(media_channel2_->sending()); | 899 EXPECT_FALSE(media_channel2_->sending()); |
893 session1_.Connect(&session2_); | 900 transport_controller1_.Connect(&transport_controller2_); |
894 EXPECT_TRUE(media_channel1_->playout()); | 901 EXPECT_TRUE(media_channel1_->playout()); |
895 EXPECT_FALSE(media_channel1_->sending()); | 902 EXPECT_FALSE(media_channel1_->sending()); |
896 EXPECT_FALSE(media_channel2_->playout()); | 903 EXPECT_FALSE(media_channel2_->playout()); |
897 EXPECT_FALSE(media_channel2_->sending()); | 904 EXPECT_FALSE(media_channel2_->sending()); |
898 EXPECT_TRUE(channel2_->Enable(true)); | 905 EXPECT_TRUE(channel2_->Enable(true)); |
899 EXPECT_TRUE(media_channel2_->playout()); | 906 EXPECT_TRUE(media_channel2_->playout()); |
900 EXPECT_TRUE(media_channel2_->sending()); | 907 EXPECT_TRUE(media_channel2_->sending()); |
901 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, | 908 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, |
902 CA_ANSWER, NULL)); | 909 CA_ANSWER, NULL)); |
903 EXPECT_TRUE(media_channel1_->playout()); | 910 EXPECT_TRUE(media_channel1_->playout()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 EXPECT_TRUE(channel2_->Enable(true)); | 948 EXPECT_TRUE(channel2_->Enable(true)); |
942 EXPECT_FALSE(media_channel1_->playout()); | 949 EXPECT_FALSE(media_channel1_->playout()); |
943 EXPECT_FALSE(media_channel1_->sending()); | 950 EXPECT_FALSE(media_channel1_->sending()); |
944 EXPECT_FALSE(media_channel2_->playout()); | 951 EXPECT_FALSE(media_channel2_->playout()); |
945 EXPECT_FALSE(media_channel2_->sending()); | 952 EXPECT_FALSE(media_channel2_->sending()); |
946 | 953 |
947 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 954 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
948 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 955 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
949 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 956 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
950 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 957 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
951 session1_.Connect(&session2_); | 958 transport_controller1_.Connect(&transport_controller2_); |
952 | 959 |
953 EXPECT_TRUE(media_channel1_->playout()); | 960 EXPECT_TRUE(media_channel1_->playout()); |
954 EXPECT_FALSE(media_channel1_->sending()); // remote InActive | 961 EXPECT_FALSE(media_channel1_->sending()); // remote InActive |
955 EXPECT_FALSE(media_channel2_->playout()); // local InActive | 962 EXPECT_FALSE(media_channel2_->playout()); // local InActive |
956 EXPECT_FALSE(media_channel2_->sending()); // local InActive | 963 EXPECT_FALSE(media_channel2_->sending()); // local InActive |
957 | 964 |
958 // Update |content2| to be RecvOnly. | 965 // Update |content2| to be RecvOnly. |
959 content2.set_direction(cricket::MD_RECVONLY); | 966 content2.set_direction(cricket::MD_RECVONLY); |
960 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 967 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
961 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 968 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 EXPECT_TRUE(SendInitiate()); | 1018 EXPECT_TRUE(SendInitiate()); |
1012 EXPECT_TRUE(SendAccept()); | 1019 EXPECT_TRUE(SendAccept()); |
1013 EXPECT_TRUE(SendTerminate()); | 1020 EXPECT_TRUE(SendTerminate()); |
1014 } | 1021 } |
1015 | 1022 |
1016 // Send voice RTP data to the other side and ensure it gets there. | 1023 // Send voice RTP data to the other side and ensure it gets there. |
1017 void SendRtpToRtp() { | 1024 void SendRtpToRtp() { |
1018 CreateChannels(0, 0); | 1025 CreateChannels(0, 0); |
1019 EXPECT_TRUE(SendInitiate()); | 1026 EXPECT_TRUE(SendInitiate()); |
1020 EXPECT_TRUE(SendAccept()); | 1027 EXPECT_TRUE(SendAccept()); |
| 1028 ASSERT_TRUE(GetTransport1()); |
| 1029 ASSERT_TRUE(GetTransport2()); |
1021 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1030 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1022 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1031 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1023 EXPECT_TRUE(SendRtp1()); | 1032 EXPECT_TRUE(SendRtp1()); |
1024 EXPECT_TRUE(SendRtp2()); | 1033 EXPECT_TRUE(SendRtp2()); |
1025 EXPECT_TRUE(CheckRtp1()); | 1034 EXPECT_TRUE(CheckRtp1()); |
1026 EXPECT_TRUE(CheckRtp2()); | 1035 EXPECT_TRUE(CheckRtp2()); |
1027 EXPECT_TRUE(CheckNoRtp1()); | 1036 EXPECT_TRUE(CheckNoRtp1()); |
1028 EXPECT_TRUE(CheckNoRtp2()); | 1037 EXPECT_TRUE(CheckNoRtp2()); |
1029 } | 1038 } |
1030 | 1039 |
1031 // Check that RTCP is not transmitted if both sides don't support RTCP. | 1040 // Check that RTCP is not transmitted if both sides don't support RTCP. |
1032 void SendNoRtcpToNoRtcp() { | 1041 void SendNoRtcpToNoRtcp() { |
1033 CreateChannels(0, 0); | 1042 CreateChannels(0, 0); |
1034 EXPECT_TRUE(SendInitiate()); | 1043 EXPECT_TRUE(SendInitiate()); |
1035 EXPECT_TRUE(SendAccept()); | 1044 EXPECT_TRUE(SendAccept()); |
| 1045 ASSERT_TRUE(GetTransport1()); |
| 1046 ASSERT_TRUE(GetTransport2()); |
1036 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1047 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1037 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1048 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1038 EXPECT_FALSE(SendRtcp1()); | 1049 EXPECT_FALSE(SendRtcp1()); |
1039 EXPECT_FALSE(SendRtcp2()); | 1050 EXPECT_FALSE(SendRtcp2()); |
1040 EXPECT_TRUE(CheckNoRtcp1()); | 1051 EXPECT_TRUE(CheckNoRtcp1()); |
1041 EXPECT_TRUE(CheckNoRtcp2()); | 1052 EXPECT_TRUE(CheckNoRtcp2()); |
1042 } | 1053 } |
1043 | 1054 |
1044 // Check that RTCP is not transmitted if the callee doesn't support RTCP. | 1055 // Check that RTCP is not transmitted if the callee doesn't support RTCP. |
1045 void SendNoRtcpToRtcp() { | 1056 void SendNoRtcpToRtcp() { |
1046 CreateChannels(0, RTCP); | 1057 CreateChannels(0, RTCP); |
1047 EXPECT_TRUE(SendInitiate()); | 1058 EXPECT_TRUE(SendInitiate()); |
1048 EXPECT_TRUE(SendAccept()); | 1059 EXPECT_TRUE(SendAccept()); |
| 1060 ASSERT_TRUE(GetTransport1()); |
| 1061 ASSERT_TRUE(GetTransport2()); |
1049 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1062 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1050 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1063 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1051 EXPECT_FALSE(SendRtcp1()); | 1064 EXPECT_FALSE(SendRtcp1()); |
1052 EXPECT_FALSE(SendRtcp2()); | 1065 EXPECT_FALSE(SendRtcp2()); |
1053 EXPECT_TRUE(CheckNoRtcp1()); | 1066 EXPECT_TRUE(CheckNoRtcp1()); |
1054 EXPECT_TRUE(CheckNoRtcp2()); | 1067 EXPECT_TRUE(CheckNoRtcp2()); |
1055 } | 1068 } |
1056 | 1069 |
1057 // Check that RTCP is not transmitted if the caller doesn't support RTCP. | 1070 // Check that RTCP is not transmitted if the caller doesn't support RTCP. |
1058 void SendRtcpToNoRtcp() { | 1071 void SendRtcpToNoRtcp() { |
1059 CreateChannels(RTCP, 0); | 1072 CreateChannels(RTCP, 0); |
1060 EXPECT_TRUE(SendInitiate()); | 1073 EXPECT_TRUE(SendInitiate()); |
1061 EXPECT_TRUE(SendAccept()); | 1074 EXPECT_TRUE(SendAccept()); |
| 1075 ASSERT_TRUE(GetTransport1()); |
| 1076 ASSERT_TRUE(GetTransport2()); |
1062 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1077 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1063 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1078 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1064 EXPECT_FALSE(SendRtcp1()); | 1079 EXPECT_FALSE(SendRtcp1()); |
1065 EXPECT_FALSE(SendRtcp2()); | 1080 EXPECT_FALSE(SendRtcp2()); |
1066 EXPECT_TRUE(CheckNoRtcp1()); | 1081 EXPECT_TRUE(CheckNoRtcp1()); |
1067 EXPECT_TRUE(CheckNoRtcp2()); | 1082 EXPECT_TRUE(CheckNoRtcp2()); |
1068 } | 1083 } |
1069 | 1084 |
1070 // Check that RTCP is transmitted if both sides support RTCP. | 1085 // Check that RTCP is transmitted if both sides support RTCP. |
1071 void SendRtcpToRtcp() { | 1086 void SendRtcpToRtcp() { |
1072 CreateChannels(RTCP, RTCP); | 1087 CreateChannels(RTCP, RTCP); |
1073 EXPECT_TRUE(SendInitiate()); | 1088 EXPECT_TRUE(SendInitiate()); |
1074 EXPECT_TRUE(SendAccept()); | 1089 EXPECT_TRUE(SendAccept()); |
| 1090 ASSERT_TRUE(GetTransport1()); |
| 1091 ASSERT_TRUE(GetTransport2()); |
1075 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1092 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1076 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1093 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1077 EXPECT_TRUE(SendRtcp1()); | 1094 EXPECT_TRUE(SendRtcp1()); |
1078 EXPECT_TRUE(SendRtcp2()); | 1095 EXPECT_TRUE(SendRtcp2()); |
1079 EXPECT_TRUE(CheckRtcp1()); | 1096 EXPECT_TRUE(CheckRtcp1()); |
1080 EXPECT_TRUE(CheckRtcp2()); | 1097 EXPECT_TRUE(CheckRtcp2()); |
1081 EXPECT_TRUE(CheckNoRtcp1()); | 1098 EXPECT_TRUE(CheckNoRtcp1()); |
1082 EXPECT_TRUE(CheckNoRtcp2()); | 1099 EXPECT_TRUE(CheckNoRtcp2()); |
1083 } | 1100 } |
1084 | 1101 |
1085 // Check that RTCP is transmitted if only the initiator supports mux. | 1102 // Check that RTCP is transmitted if only the initiator supports mux. |
1086 void SendRtcpMuxToRtcp() { | 1103 void SendRtcpMuxToRtcp() { |
1087 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1104 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1088 EXPECT_TRUE(SendInitiate()); | 1105 EXPECT_TRUE(SendInitiate()); |
1089 EXPECT_TRUE(SendAccept()); | 1106 EXPECT_TRUE(SendAccept()); |
| 1107 ASSERT_TRUE(GetTransport1()); |
| 1108 ASSERT_TRUE(GetTransport2()); |
1090 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1109 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1091 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1110 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1092 EXPECT_TRUE(SendRtcp1()); | 1111 EXPECT_TRUE(SendRtcp1()); |
1093 EXPECT_TRUE(SendRtcp2()); | 1112 EXPECT_TRUE(SendRtcp2()); |
1094 EXPECT_TRUE(CheckRtcp1()); | 1113 EXPECT_TRUE(CheckRtcp1()); |
1095 EXPECT_TRUE(CheckRtcp2()); | 1114 EXPECT_TRUE(CheckRtcp2()); |
1096 EXPECT_TRUE(CheckNoRtcp1()); | 1115 EXPECT_TRUE(CheckNoRtcp1()); |
1097 EXPECT_TRUE(CheckNoRtcp2()); | 1116 EXPECT_TRUE(CheckNoRtcp2()); |
1098 } | 1117 } |
1099 | 1118 |
1100 // Check that RTP and RTCP are transmitted ok when both sides support mux. | 1119 // Check that RTP and RTCP are transmitted ok when both sides support mux. |
1101 void SendRtcpMuxToRtcpMux() { | 1120 void SendRtcpMuxToRtcpMux() { |
1102 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1121 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1103 EXPECT_TRUE(SendInitiate()); | 1122 EXPECT_TRUE(SendInitiate()); |
| 1123 ASSERT_TRUE(GetTransport1()); |
| 1124 ASSERT_TRUE(GetTransport2()); |
1104 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1125 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1105 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1126 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1106 EXPECT_TRUE(SendAccept()); | 1127 EXPECT_TRUE(SendAccept()); |
1107 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1128 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1108 EXPECT_TRUE(SendRtp1()); | 1129 EXPECT_TRUE(SendRtp1()); |
1109 EXPECT_TRUE(SendRtp2()); | 1130 EXPECT_TRUE(SendRtp2()); |
1110 EXPECT_TRUE(SendRtcp1()); | 1131 EXPECT_TRUE(SendRtcp1()); |
1111 EXPECT_TRUE(SendRtcp2()); | 1132 EXPECT_TRUE(SendRtcp2()); |
1112 EXPECT_TRUE(CheckRtp1()); | 1133 EXPECT_TRUE(CheckRtp1()); |
1113 EXPECT_TRUE(CheckRtp2()); | 1134 EXPECT_TRUE(CheckRtp2()); |
1114 EXPECT_TRUE(CheckNoRtp1()); | 1135 EXPECT_TRUE(CheckNoRtp1()); |
1115 EXPECT_TRUE(CheckNoRtp2()); | 1136 EXPECT_TRUE(CheckNoRtp2()); |
1116 EXPECT_TRUE(CheckRtcp1()); | 1137 EXPECT_TRUE(CheckRtcp1()); |
1117 EXPECT_TRUE(CheckRtcp2()); | 1138 EXPECT_TRUE(CheckRtcp2()); |
1118 EXPECT_TRUE(CheckNoRtcp1()); | 1139 EXPECT_TRUE(CheckNoRtcp1()); |
1119 EXPECT_TRUE(CheckNoRtcp2()); | 1140 EXPECT_TRUE(CheckNoRtcp2()); |
1120 } | 1141 } |
1121 | 1142 |
1122 // Check that RTP and RTCP are transmitted ok when both sides | 1143 // Check that RTP and RTCP are transmitted ok when both sides |
1123 // support mux and one the offerer requires mux. | 1144 // support mux and one the offerer requires mux. |
1124 void SendRequireRtcpMuxToRtcpMux() { | 1145 void SendRequireRtcpMuxToRtcpMux() { |
1125 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1146 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1126 channel1_->ActivateRtcpMux(); | 1147 channel1_->ActivateRtcpMux(); |
1127 EXPECT_TRUE(SendInitiate()); | 1148 EXPECT_TRUE(SendInitiate()); |
| 1149 ASSERT_TRUE(GetTransport1()); |
| 1150 ASSERT_TRUE(GetTransport2()); |
1128 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1151 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1129 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1152 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1130 EXPECT_TRUE(SendAccept()); | 1153 EXPECT_TRUE(SendAccept()); |
1131 EXPECT_TRUE(SendRtp1()); | 1154 EXPECT_TRUE(SendRtp1()); |
1132 EXPECT_TRUE(SendRtp2()); | 1155 EXPECT_TRUE(SendRtp2()); |
1133 EXPECT_TRUE(SendRtcp1()); | 1156 EXPECT_TRUE(SendRtcp1()); |
1134 EXPECT_TRUE(SendRtcp2()); | 1157 EXPECT_TRUE(SendRtcp2()); |
1135 EXPECT_TRUE(CheckRtp1()); | 1158 EXPECT_TRUE(CheckRtp1()); |
1136 EXPECT_TRUE(CheckRtp2()); | 1159 EXPECT_TRUE(CheckRtp2()); |
1137 EXPECT_TRUE(CheckNoRtp1()); | 1160 EXPECT_TRUE(CheckNoRtp1()); |
1138 EXPECT_TRUE(CheckNoRtp2()); | 1161 EXPECT_TRUE(CheckNoRtp2()); |
1139 EXPECT_TRUE(CheckRtcp1()); | 1162 EXPECT_TRUE(CheckRtcp1()); |
1140 EXPECT_TRUE(CheckRtcp2()); | 1163 EXPECT_TRUE(CheckRtcp2()); |
1141 EXPECT_TRUE(CheckNoRtcp1()); | 1164 EXPECT_TRUE(CheckNoRtcp1()); |
1142 EXPECT_TRUE(CheckNoRtcp2()); | 1165 EXPECT_TRUE(CheckNoRtcp2()); |
1143 } | 1166 } |
1144 | 1167 |
1145 // Check that RTP and RTCP are transmitted ok when both sides | 1168 // Check that RTP and RTCP are transmitted ok when both sides |
1146 // support mux and one the answerer requires rtcp mux. | 1169 // support mux and one the answerer requires rtcp mux. |
1147 void SendRtcpMuxToRequireRtcpMux() { | 1170 void SendRtcpMuxToRequireRtcpMux() { |
1148 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1171 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1149 channel2_->ActivateRtcpMux(); | 1172 channel2_->ActivateRtcpMux(); |
1150 EXPECT_TRUE(SendInitiate()); | 1173 EXPECT_TRUE(SendInitiate()); |
| 1174 ASSERT_TRUE(GetTransport1()); |
| 1175 ASSERT_TRUE(GetTransport2()); |
1151 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1176 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1152 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1177 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1153 EXPECT_TRUE(SendAccept()); | 1178 EXPECT_TRUE(SendAccept()); |
1154 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1179 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1155 EXPECT_TRUE(SendRtp1()); | 1180 EXPECT_TRUE(SendRtp1()); |
1156 EXPECT_TRUE(SendRtp2()); | 1181 EXPECT_TRUE(SendRtp2()); |
1157 EXPECT_TRUE(SendRtcp1()); | 1182 EXPECT_TRUE(SendRtcp1()); |
1158 EXPECT_TRUE(SendRtcp2()); | 1183 EXPECT_TRUE(SendRtcp2()); |
1159 EXPECT_TRUE(CheckRtp1()); | 1184 EXPECT_TRUE(CheckRtp1()); |
1160 EXPECT_TRUE(CheckRtp2()); | 1185 EXPECT_TRUE(CheckRtp2()); |
1161 EXPECT_TRUE(CheckNoRtp1()); | 1186 EXPECT_TRUE(CheckNoRtp1()); |
1162 EXPECT_TRUE(CheckNoRtp2()); | 1187 EXPECT_TRUE(CheckNoRtp2()); |
1163 EXPECT_TRUE(CheckRtcp1()); | 1188 EXPECT_TRUE(CheckRtcp1()); |
1164 EXPECT_TRUE(CheckRtcp2()); | 1189 EXPECT_TRUE(CheckRtcp2()); |
1165 EXPECT_TRUE(CheckNoRtcp1()); | 1190 EXPECT_TRUE(CheckNoRtcp1()); |
1166 EXPECT_TRUE(CheckNoRtcp2()); | 1191 EXPECT_TRUE(CheckNoRtcp2()); |
1167 } | 1192 } |
1168 | 1193 |
1169 // Check that RTP and RTCP are transmitted ok when both sides | 1194 // Check that RTP and RTCP are transmitted ok when both sides |
1170 // require mux. | 1195 // require mux. |
1171 void SendRequireRtcpMuxToRequireRtcpMux() { | 1196 void SendRequireRtcpMuxToRequireRtcpMux() { |
1172 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1197 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1173 channel1_->ActivateRtcpMux(); | 1198 channel1_->ActivateRtcpMux(); |
1174 channel2_->ActivateRtcpMux(); | 1199 channel2_->ActivateRtcpMux(); |
1175 EXPECT_TRUE(SendInitiate()); | 1200 EXPECT_TRUE(SendInitiate()); |
| 1201 ASSERT_TRUE(GetTransport1()); |
| 1202 ASSERT_TRUE(GetTransport2()); |
1176 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1203 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1177 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1204 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1178 EXPECT_TRUE(SendAccept()); | 1205 EXPECT_TRUE(SendAccept()); |
1179 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1206 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1180 EXPECT_TRUE(SendRtp1()); | 1207 EXPECT_TRUE(SendRtp1()); |
1181 EXPECT_TRUE(SendRtp2()); | 1208 EXPECT_TRUE(SendRtp2()); |
1182 EXPECT_TRUE(SendRtcp1()); | 1209 EXPECT_TRUE(SendRtcp1()); |
1183 EXPECT_TRUE(SendRtcp2()); | 1210 EXPECT_TRUE(SendRtcp2()); |
1184 EXPECT_TRUE(CheckRtp1()); | 1211 EXPECT_TRUE(CheckRtp1()); |
1185 EXPECT_TRUE(CheckRtp2()); | 1212 EXPECT_TRUE(CheckRtp2()); |
1186 EXPECT_TRUE(CheckNoRtp1()); | 1213 EXPECT_TRUE(CheckNoRtp1()); |
1187 EXPECT_TRUE(CheckNoRtp2()); | 1214 EXPECT_TRUE(CheckNoRtp2()); |
1188 EXPECT_TRUE(CheckRtcp1()); | 1215 EXPECT_TRUE(CheckRtcp1()); |
1189 EXPECT_TRUE(CheckRtcp2()); | 1216 EXPECT_TRUE(CheckRtcp2()); |
1190 EXPECT_TRUE(CheckNoRtcp1()); | 1217 EXPECT_TRUE(CheckNoRtcp1()); |
1191 EXPECT_TRUE(CheckNoRtcp2()); | 1218 EXPECT_TRUE(CheckNoRtcp2()); |
1192 } | 1219 } |
1193 | 1220 |
1194 // Check that SendAccept fails if the answerer doesn't support mux | 1221 // Check that SendAccept fails if the answerer doesn't support mux |
1195 // and the offerer requires it. | 1222 // and the offerer requires it. |
1196 void SendRequireRtcpMuxToNoRtcpMux() { | 1223 void SendRequireRtcpMuxToNoRtcpMux() { |
1197 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1224 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1198 channel1_->ActivateRtcpMux(); | 1225 channel1_->ActivateRtcpMux(); |
1199 EXPECT_TRUE(SendInitiate()); | 1226 EXPECT_TRUE(SendInitiate()); |
| 1227 ASSERT_TRUE(GetTransport1()); |
| 1228 ASSERT_TRUE(GetTransport2()); |
1200 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1229 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1201 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1230 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1202 EXPECT_FALSE(SendAccept()); | 1231 EXPECT_FALSE(SendAccept()); |
1203 } | 1232 } |
1204 | 1233 |
1205 // Check that RTCP data sent by the initiator before the accept is not muxed. | 1234 // Check that RTCP data sent by the initiator before the accept is not muxed. |
1206 void SendEarlyRtcpMuxToRtcp() { | 1235 void SendEarlyRtcpMuxToRtcp() { |
1207 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1236 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1208 EXPECT_TRUE(SendInitiate()); | 1237 EXPECT_TRUE(SendInitiate()); |
| 1238 ASSERT_TRUE(GetTransport1()); |
| 1239 ASSERT_TRUE(GetTransport2()); |
1209 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1240 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1210 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1241 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1211 | 1242 |
1212 // RTCP can be sent before the call is accepted, if the transport is ready. | 1243 // RTCP can be sent before the call is accepted, if the transport is ready. |
1213 // It should not be muxed though, as the remote side doesn't support mux. | 1244 // It should not be muxed though, as the remote side doesn't support mux. |
1214 EXPECT_TRUE(SendRtcp1()); | 1245 EXPECT_TRUE(SendRtcp1()); |
1215 EXPECT_TRUE(CheckNoRtp2()); | 1246 EXPECT_TRUE(CheckNoRtp2()); |
1216 EXPECT_TRUE(CheckRtcp2()); | 1247 EXPECT_TRUE(CheckRtcp2()); |
1217 | 1248 |
1218 // Send RTCP packet from callee and verify that it is received. | 1249 // Send RTCP packet from callee and verify that it is received. |
(...skipping 10 matching lines...) Expand all Loading... |
1229 EXPECT_TRUE(CheckRtcp1()); | 1260 EXPECT_TRUE(CheckRtcp1()); |
1230 } | 1261 } |
1231 | 1262 |
1232 | 1263 |
1233 // Check that RTCP data is not muxed until both sides have enabled muxing, | 1264 // Check that RTCP data is not muxed until both sides have enabled muxing, |
1234 // but that we properly demux before we get the accept message, since there | 1265 // but that we properly demux before we get the accept message, since there |
1235 // is a race between RTP data and the jingle accept. | 1266 // is a race between RTP data and the jingle accept. |
1236 void SendEarlyRtcpMuxToRtcpMux() { | 1267 void SendEarlyRtcpMuxToRtcpMux() { |
1237 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1268 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1238 EXPECT_TRUE(SendInitiate()); | 1269 EXPECT_TRUE(SendInitiate()); |
| 1270 ASSERT_TRUE(GetTransport1()); |
| 1271 ASSERT_TRUE(GetTransport2()); |
1239 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1272 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1240 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1273 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1241 | 1274 |
1242 // RTCP can't be sent yet, since the RTCP transport isn't writable, and | 1275 // RTCP can't be sent yet, since the RTCP transport isn't writable, and |
1243 // we haven't yet received the accept that says we should mux. | 1276 // we haven't yet received the accept that says we should mux. |
1244 EXPECT_FALSE(SendRtcp1()); | 1277 EXPECT_FALSE(SendRtcp1()); |
1245 | 1278 |
1246 // Send muxed RTCP packet from callee and verify that it is received. | 1279 // Send muxed RTCP packet from callee and verify that it is received. |
1247 EXPECT_TRUE(SendRtcp2()); | 1280 EXPECT_TRUE(SendRtcp2()); |
1248 EXPECT_TRUE(CheckNoRtp1()); | 1281 EXPECT_TRUE(CheckNoRtp1()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. | 1352 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. |
1320 void SendEarlyMediaUsingRtcpMuxSrtp() { | 1353 void SendEarlyMediaUsingRtcpMuxSrtp() { |
1321 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1354 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
1322 | 1355 |
1323 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, | 1356 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, |
1324 SSRC_MUX | RTCP | RTCP_MUX | SECURE); | 1357 SSRC_MUX | RTCP | RTCP_MUX | SECURE); |
1325 EXPECT_TRUE(SendOffer()); | 1358 EXPECT_TRUE(SendOffer()); |
1326 EXPECT_TRUE(SendProvisionalAnswer()); | 1359 EXPECT_TRUE(SendProvisionalAnswer()); |
1327 EXPECT_TRUE(channel1_->secure()); | 1360 EXPECT_TRUE(channel1_->secure()); |
1328 EXPECT_TRUE(channel2_->secure()); | 1361 EXPECT_TRUE(channel2_->secure()); |
| 1362 ASSERT_TRUE(GetTransport1()); |
| 1363 ASSERT_TRUE(GetTransport2()); |
1329 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1364 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1330 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1365 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1331 EXPECT_TRUE(SendCustomRtcp1(kSsrc1)); | 1366 EXPECT_TRUE(SendCustomRtcp1(kSsrc1)); |
1332 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1367 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
1333 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1)); | 1368 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1)); |
1334 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1369 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
1335 | 1370 |
1336 // Send packets from callee and verify that it is received. | 1371 // Send packets from callee and verify that it is received. |
1337 EXPECT_TRUE(SendCustomRtcp2(kSsrc2)); | 1372 EXPECT_TRUE(SendCustomRtcp2(kSsrc2)); |
1338 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1373 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 EXPECT_TRUE(CheckNoRtcp1()); | 1437 EXPECT_TRUE(CheckNoRtcp1()); |
1403 EXPECT_TRUE(CheckNoRtcp2()); | 1438 EXPECT_TRUE(CheckNoRtcp2()); |
1404 } | 1439 } |
1405 | 1440 |
1406 // Test that the mediachannel retains its sending state after the transport | 1441 // Test that the mediachannel retains its sending state after the transport |
1407 // becomes non-writable. | 1442 // becomes non-writable. |
1408 void SendWithWritabilityLoss() { | 1443 void SendWithWritabilityLoss() { |
1409 CreateChannels(0, 0); | 1444 CreateChannels(0, 0); |
1410 EXPECT_TRUE(SendInitiate()); | 1445 EXPECT_TRUE(SendInitiate()); |
1411 EXPECT_TRUE(SendAccept()); | 1446 EXPECT_TRUE(SendAccept()); |
| 1447 ASSERT_TRUE(GetTransport1()); |
| 1448 ASSERT_TRUE(GetTransport2()); |
1412 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1449 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1413 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1450 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1414 EXPECT_TRUE(SendRtp1()); | 1451 EXPECT_TRUE(SendRtp1()); |
1415 EXPECT_TRUE(SendRtp2()); | 1452 EXPECT_TRUE(SendRtp2()); |
1416 EXPECT_TRUE(CheckRtp1()); | 1453 EXPECT_TRUE(CheckRtp1()); |
1417 EXPECT_TRUE(CheckRtp2()); | 1454 EXPECT_TRUE(CheckRtp2()); |
1418 EXPECT_TRUE(CheckNoRtp1()); | 1455 EXPECT_TRUE(CheckNoRtp1()); |
1419 EXPECT_TRUE(CheckNoRtp2()); | 1456 EXPECT_TRUE(CheckNoRtp2()); |
1420 | 1457 |
1421 // Lose writability, which should fail. | 1458 // Lose writability, which should fail. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 int pl_type2 = pl_types[1]; | 1503 int pl_type2 = pl_types[1]; |
1467 int flags = SSRC_MUX | RTCP; | 1504 int flags = SSRC_MUX | RTCP; |
1468 if (secure) flags |= SECURE; | 1505 if (secure) flags |= SECURE; |
1469 uint32 expected_channels = 2U; | 1506 uint32 expected_channels = 2U; |
1470 if (rtcp_mux) { | 1507 if (rtcp_mux) { |
1471 flags |= RTCP_MUX; | 1508 flags |= RTCP_MUX; |
1472 expected_channels = 1U; | 1509 expected_channels = 1U; |
1473 } | 1510 } |
1474 CreateChannels(flags, flags); | 1511 CreateChannels(flags, flags); |
1475 EXPECT_TRUE(SendInitiate()); | 1512 EXPECT_TRUE(SendInitiate()); |
| 1513 ASSERT_TRUE(GetTransport1()); |
| 1514 ASSERT_TRUE(GetTransport2()); |
1476 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1515 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1477 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); | 1516 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1478 EXPECT_TRUE(SendAccept()); | 1517 EXPECT_TRUE(SendAccept()); |
1479 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); | 1518 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); |
1480 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); | 1519 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1481 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); | 1520 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); |
1482 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); | 1521 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); |
1483 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); | 1522 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); |
1484 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); | 1523 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); |
1485 // channel1 - should only have media_content2 as remote. i.e. kSsrc2 | 1524 // channel1 - should only have media_content2 as remote. i.e. kSsrc2 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); | 1693 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); |
1655 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); | 1694 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); |
1656 } | 1695 } |
1657 | 1696 |
1658 void TestFlushRtcp() { | 1697 void TestFlushRtcp() { |
1659 bool send_rtcp1; | 1698 bool send_rtcp1; |
1660 | 1699 |
1661 CreateChannels(RTCP, RTCP); | 1700 CreateChannels(RTCP, RTCP); |
1662 EXPECT_TRUE(SendInitiate()); | 1701 EXPECT_TRUE(SendInitiate()); |
1663 EXPECT_TRUE(SendAccept()); | 1702 EXPECT_TRUE(SendAccept()); |
| 1703 ASSERT_TRUE(GetTransport1()); |
| 1704 ASSERT_TRUE(GetTransport2()); |
1664 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1705 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1665 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1706 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1666 | 1707 |
1667 // Send RTCP1 from a different thread. | 1708 // Send RTCP1 from a different thread. |
1668 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1); | 1709 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1); |
1669 EXPECT_TRUE(send_rtcp1); | 1710 EXPECT_TRUE(send_rtcp1); |
1670 // The sending message is only posted. channel2_ should be empty. | 1711 // The sending message is only posted. channel2_ should be empty. |
1671 EXPECT_TRUE(CheckNoRtcp2()); | 1712 EXPECT_TRUE(CheckNoRtcp2()); |
1672 | 1713 |
1673 // When channel1_ is deleted, the RTCP packet should be sent out to | 1714 // When channel1_ is deleted, the RTCP packet should be sent out to |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); | 1783 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); |
1743 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1784 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1744 rtp->SignalReadyToSend(rtp); | 1785 rtp->SignalReadyToSend(rtp); |
1745 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1786 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1746 rtcp->SignalReadyToSend(rtcp); | 1787 rtcp->SignalReadyToSend(rtcp); |
1747 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp | 1788 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp |
1748 // channel are ready to send. | 1789 // channel are ready to send. |
1749 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1790 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1750 | 1791 |
1751 // rtp channel becomes not ready to send will be propagated to mediachannel | 1792 // rtp channel becomes not ready to send will be propagated to mediachannel |
1752 channel1_->SetReadyToSend(rtp, false); | 1793 channel1_->SetReadyToSend(false, false); |
1753 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1794 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1754 channel1_->SetReadyToSend(rtp, true); | 1795 channel1_->SetReadyToSend(false, true); |
1755 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1796 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1756 | 1797 |
1757 // rtcp channel becomes not ready to send will be propagated to mediachannel | 1798 // rtcp channel becomes not ready to send will be propagated to mediachannel |
1758 channel1_->SetReadyToSend(rtcp, false); | 1799 channel1_->SetReadyToSend(true, false); |
1759 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1800 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1760 channel1_->SetReadyToSend(rtcp, true); | 1801 channel1_->SetReadyToSend(true, true); |
1761 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1802 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1762 } | 1803 } |
1763 | 1804 |
1764 void TestOnReadyToSendWithRtcpMux() { | 1805 void TestOnReadyToSendWithRtcpMux() { |
1765 CreateChannels(RTCP, RTCP); | 1806 CreateChannels(RTCP, RTCP); |
1766 typename T::Content content; | 1807 typename T::Content content; |
1767 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1808 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1768 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1809 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
1769 content.set_rtcp_mux(true); | 1810 content.set_rtcp_mux(true); |
1770 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1811 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
1771 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1812 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
1772 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 1813 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); |
1773 TransportChannel* rtp = channel1_->transport_channel(); | 1814 TransportChannel* rtp = channel1_->transport_channel(); |
1774 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1815 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1775 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1816 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1776 // should trigger the MediaChannel's OnReadyToSend. | 1817 // should trigger the MediaChannel's OnReadyToSend. |
1777 rtp->SignalReadyToSend(rtp); | 1818 rtp->SignalReadyToSend(rtp); |
1778 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1819 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1779 channel1_->SetReadyToSend(rtp, false); | 1820 channel1_->SetReadyToSend(false, false); |
1780 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1821 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1781 } | 1822 } |
1782 | 1823 |
1783 protected: | 1824 protected: |
1784 cricket::FakeSession session1_; | 1825 cricket::FakeTransportController transport_controller1_; |
1785 cricket::FakeSession session2_; | 1826 cricket::FakeTransportController transport_controller2_; |
1786 cricket::FakeMediaEngine media_engine_; | 1827 cricket::FakeMediaEngine media_engine_; |
1787 // The media channels are owned by the voice channel objects below. | 1828 // The media channels are owned by the voice channel objects below. |
1788 typename T::MediaChannel* media_channel1_; | 1829 typename T::MediaChannel* media_channel1_; |
1789 typename T::MediaChannel* media_channel2_; | 1830 typename T::MediaChannel* media_channel2_; |
1790 rtc::scoped_ptr<typename T::Channel> channel1_; | 1831 rtc::scoped_ptr<typename T::Channel> channel1_; |
1791 rtc::scoped_ptr<typename T::Channel> channel2_; | 1832 rtc::scoped_ptr<typename T::Channel> channel2_; |
1792 typename T::Content local_media_content1_; | 1833 typename T::Content local_media_content1_; |
1793 typename T::Content local_media_content2_; | 1834 typename T::Content local_media_content2_; |
1794 typename T::Content remote_media_content1_; | 1835 typename T::Content remote_media_content1_; |
1795 typename T::Content remote_media_content2_; | 1836 typename T::Content remote_media_content2_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 channel1_->SetChannelOptions(options2); | 1910 channel1_->SetChannelOptions(options2); |
1870 channel2_->SetChannelOptions(options2); | 1911 channel2_->SetChannelOptions(options2); |
1871 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options)); | 1912 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options)); |
1872 EXPECT_EQ(options2, actual_options); | 1913 EXPECT_EQ(options2, actual_options); |
1873 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options)); | 1914 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options)); |
1874 EXPECT_EQ(options2, actual_options); | 1915 EXPECT_EQ(options2, actual_options); |
1875 } | 1916 } |
1876 }; | 1917 }; |
1877 | 1918 |
1878 // override to add NULL parameter | 1919 // override to add NULL parameter |
1879 template<> | 1920 template <> |
1880 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1921 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
1881 rtc::Thread* thread, cricket::MediaEngineInterface* engine, | 1922 rtc::Thread* thread, |
1882 cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session, | 1923 cricket::MediaEngineInterface* engine, |
| 1924 cricket::FakeVideoMediaChannel* ch, |
| 1925 cricket::TransportController* transport_controller, |
1883 bool rtcp) { | 1926 bool rtcp) { |
1884 cricket::VideoChannel* channel = new cricket::VideoChannel( | 1927 cricket::VideoChannel* channel = new cricket::VideoChannel( |
1885 thread, ch, session, cricket::CN_VIDEO, rtcp); | 1928 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); |
1886 if (!channel->Init()) { | 1929 if (!channel->Init()) { |
1887 delete channel; | 1930 delete channel; |
1888 channel = NULL; | 1931 channel = NULL; |
1889 } | 1932 } |
1890 return channel; | 1933 return channel; |
1891 } | 1934 } |
1892 | 1935 |
1893 // override to add 0 parameter | 1936 // override to add 0 parameter |
1894 template<> | 1937 template<> |
1895 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 1938 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 : public ChannelTest<DataTraits> { | 2727 : public ChannelTest<DataTraits> { |
2685 public: | 2728 public: |
2686 typedef ChannelTest<DataTraits> | 2729 typedef ChannelTest<DataTraits> |
2687 Base; | 2730 Base; |
2688 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), | 2731 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), |
2689 kRtcpReport, sizeof(kRtcpReport)) { | 2732 kRtcpReport, sizeof(kRtcpReport)) { |
2690 } | 2733 } |
2691 }; | 2734 }; |
2692 | 2735 |
2693 // Override to avoid engine channel parameter. | 2736 // Override to avoid engine channel parameter. |
2694 template<> | 2737 template <> |
2695 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2738 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
2696 rtc::Thread* thread, cricket::MediaEngineInterface* engine, | 2739 rtc::Thread* thread, |
2697 cricket::FakeDataMediaChannel* ch, cricket::BaseSession* session, | 2740 cricket::MediaEngineInterface* engine, |
| 2741 cricket::FakeDataMediaChannel* ch, |
| 2742 cricket::TransportController* transport_controller, |
2698 bool rtcp) { | 2743 bool rtcp) { |
2699 cricket::DataChannel* channel = new cricket::DataChannel( | 2744 cricket::DataChannel* channel = new cricket::DataChannel( |
2700 thread, ch, session, cricket::CN_DATA, rtcp); | 2745 thread, ch, transport_controller, cricket::CN_DATA, rtcp); |
2701 if (!channel->Init()) { | 2746 if (!channel->Init()) { |
2702 delete channel; | 2747 delete channel; |
2703 channel = NULL; | 2748 channel = NULL; |
2704 } | 2749 } |
2705 return channel; | 2750 return channel; |
2706 } | 2751 } |
2707 | 2752 |
2708 template<> | 2753 template<> |
2709 void ChannelTest<DataTraits>::CreateContent( | 2754 void ChannelTest<DataTraits>::CreateContent( |
2710 int flags, | 2755 int flags, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 }; | 2921 }; |
2877 rtc::Buffer payload(data, 3); | 2922 rtc::Buffer payload(data, 3); |
2878 cricket::SendDataResult result; | 2923 cricket::SendDataResult result; |
2879 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2924 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2880 EXPECT_EQ(params.ssrc, | 2925 EXPECT_EQ(params.ssrc, |
2881 media_channel1_->last_sent_data_params().ssrc); | 2926 media_channel1_->last_sent_data_params().ssrc); |
2882 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2927 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2883 } | 2928 } |
2884 | 2929 |
2885 // TODO(pthatcher): TestSetReceiver? | 2930 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |