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