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/faketransportcontroller.h" | 36 #include "webrtc/p2p/base/fakesession.h" |
37 #include "talk/session/media/channel.h" | 37 #include "talk/session/media/channel.h" |
38 #include "webrtc/base/fileutils.h" | 38 #include "webrtc/base/fileutils.h" |
39 #include "webrtc/base/gunit.h" | 39 #include "webrtc/base/gunit.h" |
40 #include "webrtc/base/helpers.h" | 40 #include "webrtc/base/helpers.h" |
41 #include "webrtc/base/logging.h" | 41 #include "webrtc/base/logging.h" |
42 #include "webrtc/base/pathutils.h" | 42 #include "webrtc/base/pathutils.h" |
43 #include "webrtc/base/signalthread.h" | 43 #include "webrtc/base/signalthread.h" |
44 #include "webrtc/base/ssladapter.h" | 44 #include "webrtc/base/ssladapter.h" |
45 #include "webrtc/base/sslidentity.h" | 45 #include "webrtc/base/sslidentity.h" |
46 #include "webrtc/base/window.h" | 46 #include "webrtc/base/window.h" |
(...skipping 19 matching lines...) Expand all Loading... |
66 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1, 0); | 66 static const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1, 0); |
67 static const cricket::VideoCodec kH264Codec(97, "H264", 640, 400, 30, 0); | 67 static const cricket::VideoCodec kH264Codec(97, "H264", 640, 400, 30, 0); |
68 static const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC", 320, 200, 15, 0); | 68 static const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC", 320, 200, 15, 0); |
69 static const cricket::DataCodec kGoogleDataCodec(101, "google-data", 0); | 69 static const cricket::DataCodec kGoogleDataCodec(101, "google-data", 0); |
70 static const uint32 kSsrc1 = 0x1111; | 70 static const uint32 kSsrc1 = 0x1111; |
71 static const uint32 kSsrc2 = 0x2222; | 71 static const uint32 kSsrc2 = 0x2222; |
72 static const uint32 kSsrc3 = 0x3333; | 72 static const uint32 kSsrc3 = 0x3333; |
73 static const int kAudioPts[] = {0, 8}; | 73 static const int kAudioPts[] = {0, 8}; |
74 static const int kVideoPts[] = {97, 99}; | 74 static const int kVideoPts[] = {97, 99}; |
75 | 75 |
76 template <class ChannelT, | 76 template<class ChannelT, |
77 class MediaChannelT, | 77 class MediaChannelT, |
78 class ContentT, | 78 class ContentT, |
79 class CodecT, | 79 class CodecT, |
80 class MediaInfoT, | 80 class MediaInfoT, |
81 class OptionsT> | 81 class OptionsT> |
82 class Traits { | 82 class Traits { |
83 public: | 83 public: |
84 typedef ChannelT Channel; | 84 typedef ChannelT Channel; |
85 typedef MediaChannelT MediaChannel; | 85 typedef MediaChannelT MediaChannel; |
86 typedef ContentT Content; | 86 typedef ContentT Content; |
87 typedef CodecT Codec; | 87 typedef CodecT Codec; |
88 typedef MediaInfoT MediaInfo; | 88 typedef MediaInfoT MediaInfo; |
89 typedef OptionsT Options; | 89 typedef OptionsT Options; |
90 }; | 90 }; |
91 | 91 |
92 // Controls how long we wait for a session to send messages that we | 92 // Controls how long we wait for a session to send messages that we |
93 // expect, in milliseconds. We put it high to avoid flaky tests. | 93 // expect, in milliseconds. We put it high to avoid flaky tests. |
94 static const int kEventTimeout = 5000; | 94 static const int kEventTimeout = 5000; |
95 | 95 |
96 class VoiceTraits : public Traits<cricket::VoiceChannel, | 96 class VoiceTraits : public Traits<cricket::VoiceChannel, |
97 cricket::FakeVoiceMediaChannel, | 97 cricket::FakeVoiceMediaChannel, |
98 cricket::AudioContentDescription, | 98 cricket::AudioContentDescription, |
99 cricket::AudioCodec, | 99 cricket::AudioCodec, |
100 cricket::VoiceMediaInfo, | 100 cricket::VoiceMediaInfo, |
101 cricket::AudioOptions> {}; | 101 cricket::AudioOptions> { |
| 102 }; |
102 | 103 |
103 class VideoTraits : public Traits<cricket::VideoChannel, | 104 class VideoTraits : public Traits<cricket::VideoChannel, |
104 cricket::FakeVideoMediaChannel, | 105 cricket::FakeVideoMediaChannel, |
105 cricket::VideoContentDescription, | 106 cricket::VideoContentDescription, |
106 cricket::VideoCodec, | 107 cricket::VideoCodec, |
107 cricket::VideoMediaInfo, | 108 cricket::VideoMediaInfo, |
108 cricket::VideoOptions> {}; | 109 cricket::VideoOptions> { |
| 110 }; |
109 | 111 |
110 class DataTraits : public Traits<cricket::DataChannel, | 112 class DataTraits : public Traits<cricket::DataChannel, |
111 cricket::FakeDataMediaChannel, | 113 cricket::FakeDataMediaChannel, |
112 cricket::DataContentDescription, | 114 cricket::DataContentDescription, |
113 cricket::DataCodec, | 115 cricket::DataCodec, |
114 cricket::DataMediaInfo, | 116 cricket::DataMediaInfo, |
115 cricket::DataOptions> {}; | 117 cricket::DataOptions> { |
| 118 }; |
| 119 |
116 | 120 |
117 rtc::StreamInterface* Open(const std::string& path) { | 121 rtc::StreamInterface* Open(const std::string& path) { |
118 return rtc::Filesystem::OpenFile( | 122 return rtc::Filesystem::OpenFile( |
119 rtc::Pathname(path), "wb"); | 123 rtc::Pathname(path), "wb"); |
120 } | 124 } |
121 | 125 |
122 // Base class for Voice/VideoChannel tests | 126 // Base class for Voice/VideoChannel tests |
123 template<class T> | 127 template<class T> |
124 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 128 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
125 public: | 129 public: |
126 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, | 130 enum Flags { RTCP = 0x1, RTCP_MUX = 0x2, SECURE = 0x4, SSRC_MUX = 0x8, |
127 DTLS = 0x10 }; | 131 DTLS = 0x10 }; |
128 | 132 |
129 ChannelTest(const uint8* rtp_data, | 133 ChannelTest(const uint8* rtp_data, int rtp_len, |
130 int rtp_len, | 134 const uint8* rtcp_data, int rtcp_len) |
131 const uint8* rtcp_data, | 135 : session1_(true), |
132 int rtcp_len) | 136 session2_(false), |
133 : transport_controller1_(cricket::ICEROLE_CONTROLLING), | |
134 transport_controller2_(cricket::ICEROLE_CONTROLLED), | |
135 media_channel1_(NULL), | 137 media_channel1_(NULL), |
136 media_channel2_(NULL), | 138 media_channel2_(NULL), |
137 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), | 139 rtp_packet_(reinterpret_cast<const char*>(rtp_data), rtp_len), |
138 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), | 140 rtcp_packet_(reinterpret_cast<const char*>(rtcp_data), rtcp_len), |
139 media_info_callbacks1_(), | 141 media_info_callbacks1_(), |
140 media_info_callbacks2_(), | 142 media_info_callbacks2_(), |
141 ssrc_(0), | 143 ssrc_(0), |
142 error_(T::MediaChannel::ERROR_NONE) {} | 144 error_(T::MediaChannel::ERROR_NONE) { |
| 145 } |
143 | 146 |
144 void CreateChannels(int flags1, int flags2) { | 147 void CreateChannels(int flags1, int flags2) { |
145 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 148 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), |
146 new typename T::MediaChannel(NULL, typename T::Options()), | 149 new typename T::MediaChannel(NULL, typename T::Options()), |
147 flags1, flags2, rtc::Thread::Current()); | 150 flags1, flags2, rtc::Thread::Current()); |
148 } | 151 } |
149 void CreateChannels( | 152 void CreateChannels( |
150 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, | 153 typename T::MediaChannel* ch1, typename T::MediaChannel* ch2, |
151 int flags1, int flags2, rtc::Thread* thread) { | 154 int flags1, int flags2, rtc::Thread* thread) { |
152 media_channel1_ = ch1; | 155 media_channel1_ = ch1; |
153 media_channel2_ = ch2; | 156 media_channel2_ = ch2; |
154 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, | 157 channel1_.reset(CreateChannel(thread, &media_engine_, ch1, &session1_, |
155 &transport_controller1_, | |
156 (flags1 & RTCP) != 0)); | 158 (flags1 & RTCP) != 0)); |
157 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, | 159 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session2_, |
158 &transport_controller2_, | |
159 (flags2 & RTCP) != 0)); | 160 (flags2 & RTCP) != 0)); |
160 channel1_->SignalMediaMonitor.connect( | 161 channel1_->SignalMediaMonitor.connect( |
161 this, &ChannelTest<T>::OnMediaMonitor); | 162 this, &ChannelTest<T>::OnMediaMonitor); |
162 channel2_->SignalMediaMonitor.connect( | 163 channel2_->SignalMediaMonitor.connect( |
163 this, &ChannelTest<T>::OnMediaMonitor); | 164 this, &ChannelTest<T>::OnMediaMonitor); |
164 channel1_->SignalMediaError.connect( | 165 channel1_->SignalMediaError.connect( |
165 this, &ChannelTest<T>::OnMediaChannelError); | 166 this, &ChannelTest<T>::OnMediaChannelError); |
166 channel2_->SignalMediaError.connect( | 167 channel2_->SignalMediaError.connect( |
167 this, &ChannelTest<T>::OnMediaChannelError); | 168 this, &ChannelTest<T>::OnMediaChannelError); |
168 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 169 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
169 flags1 = (flags1 & ~SECURE); | 170 flags1 = (flags1 & ~SECURE); |
170 flags2 = (flags2 & ~SECURE); | 171 flags2 = (flags2 & ~SECURE); |
171 } | 172 } |
172 CreateContent(flags1, kPcmuCodec, kH264Codec, | 173 CreateContent(flags1, kPcmuCodec, kH264Codec, |
173 &local_media_content1_); | 174 &local_media_content1_); |
174 CreateContent(flags2, kPcmuCodec, kH264Codec, | 175 CreateContent(flags2, kPcmuCodec, kH264Codec, |
175 &local_media_content2_); | 176 &local_media_content2_); |
176 CopyContent(local_media_content1_, &remote_media_content1_); | 177 CopyContent(local_media_content1_, &remote_media_content1_); |
177 CopyContent(local_media_content2_, &remote_media_content2_); | 178 CopyContent(local_media_content2_, &remote_media_content2_); |
178 | 179 |
179 if (flags1 & DTLS) { | 180 if (flags1 & DTLS) { |
180 // Confirmed to work with KT_RSA and KT_ECDSA. | 181 // Confirmed to work with KT_RSA and KT_ECDSA. |
181 transport_controller1_.SetLocalCertificate(rtc::RTCCertificate::Create( | 182 session1_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( |
182 rtc::scoped_ptr<rtc::SSLIdentity>( | 183 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( |
183 rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)) | 184 "session1", rtc::KT_DEFAULT)).Pass())); |
184 .Pass())); | |
185 } | 185 } |
186 if (flags2 & DTLS) { | 186 if (flags2 & DTLS) { |
187 // Confirmed to work with KT_RSA and KT_ECDSA. | 187 // Confirmed to work with KT_RSA and KT_ECDSA. |
188 transport_controller2_.SetLocalCertificate(rtc::RTCCertificate::Create( | 188 session2_.set_ssl_rtccertificate(rtc::RTCCertificate::Create( |
189 rtc::scoped_ptr<rtc::SSLIdentity>( | 189 rtc::scoped_ptr<rtc::SSLIdentity>(rtc::SSLIdentity::Generate( |
190 rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)) | 190 "session2", rtc::KT_DEFAULT)).Pass())); |
191 .Pass())); | |
192 } | 191 } |
193 | 192 |
194 // Add stream information (SSRC) to the local content but not to the remote | 193 // Add stream information (SSRC) to the local content but not to the remote |
195 // content. This means that we per default know the SSRC of what we send but | 194 // content. This means that we per default know the SSRC of what we send but |
196 // not what we receive. | 195 // not what we receive. |
197 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); | 196 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); |
198 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); | 197 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); |
199 | 198 |
200 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. | 199 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. |
201 if (flags1 & SSRC_MUX) { | 200 if (flags1 & SSRC_MUX) { |
202 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); | 201 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); |
203 } | 202 } |
204 if (flags2 & SSRC_MUX) { | 203 if (flags2 & SSRC_MUX) { |
205 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 204 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
206 } | 205 } |
207 } | 206 } |
208 typename T::Channel* CreateChannel( | 207 typename T::Channel* CreateChannel(rtc::Thread* thread, |
209 rtc::Thread* thread, | 208 cricket::MediaEngineInterface* engine, |
210 cricket::MediaEngineInterface* engine, | 209 typename T::MediaChannel* ch, |
211 typename T::MediaChannel* ch, | 210 cricket::BaseSession* session, |
212 cricket::TransportController* transport_controller, | 211 bool rtcp) { |
213 bool rtcp) { | |
214 typename T::Channel* channel = new typename T::Channel( | 212 typename T::Channel* channel = new typename T::Channel( |
215 thread, engine, ch, transport_controller, cricket::CN_AUDIO, rtcp); | 213 thread, engine, ch, session, cricket::CN_AUDIO, rtcp); |
216 if (!channel->Init()) { | 214 if (!channel->Init()) { |
217 delete channel; | 215 delete channel; |
218 channel = NULL; | 216 channel = NULL; |
219 } | 217 } |
220 return channel; | 218 return channel; |
221 } | 219 } |
222 | 220 |
223 bool SendInitiate() { | 221 bool SendInitiate() { |
224 bool result = channel1_->SetLocalContent(&local_media_content1_, | 222 bool result = channel1_->SetLocalContent(&local_media_content1_, |
225 CA_OFFER, NULL); | 223 CA_OFFER, NULL); |
226 if (result) { | 224 if (result) { |
227 channel1_->Enable(true); | 225 channel1_->Enable(true); |
228 result = channel2_->SetRemoteContent(&remote_media_content1_, | 226 result = channel2_->SetRemoteContent(&remote_media_content1_, |
229 CA_OFFER, NULL); | 227 CA_OFFER, NULL); |
230 if (result) { | 228 if (result) { |
231 transport_controller1_.Connect(&transport_controller2_); | 229 session1_.Connect(&session2_); |
232 | 230 |
233 result = channel2_->SetLocalContent(&local_media_content2_, | 231 result = channel2_->SetLocalContent(&local_media_content2_, |
234 CA_ANSWER, NULL); | 232 CA_ANSWER, NULL); |
235 } | 233 } |
236 } | 234 } |
237 return result; | 235 return result; |
238 } | 236 } |
239 | 237 |
240 bool SendAccept() { | 238 bool SendAccept() { |
241 channel2_->Enable(true); | 239 channel2_->Enable(true); |
(...skipping 12 matching lines...) Expand all Loading... |
254 return result; | 252 return result; |
255 } | 253 } |
256 | 254 |
257 bool SendProvisionalAnswer() { | 255 bool SendProvisionalAnswer() { |
258 bool result = channel2_->SetLocalContent(&local_media_content2_, | 256 bool result = channel2_->SetLocalContent(&local_media_content2_, |
259 CA_PRANSWER, NULL); | 257 CA_PRANSWER, NULL); |
260 if (result) { | 258 if (result) { |
261 channel2_->Enable(true); | 259 channel2_->Enable(true); |
262 result = channel1_->SetRemoteContent(&remote_media_content2_, | 260 result = channel1_->SetRemoteContent(&remote_media_content2_, |
263 CA_PRANSWER, NULL); | 261 CA_PRANSWER, NULL); |
264 transport_controller1_.Connect(&transport_controller2_); | 262 session1_.Connect(&session2_); |
265 } | 263 } |
266 return result; | 264 return result; |
267 } | 265 } |
268 | 266 |
269 bool SendFinalAnswer() { | 267 bool SendFinalAnswer() { |
270 bool result = channel2_->SetLocalContent(&local_media_content2_, | 268 bool result = channel2_->SetLocalContent(&local_media_content2_, |
271 CA_ANSWER, NULL); | 269 CA_ANSWER, NULL); |
272 if (result) | 270 if (result) |
273 result = channel1_->SetRemoteContent(&remote_media_content2_, | 271 result = channel1_->SetRemoteContent(&remote_media_content2_, |
274 CA_ANSWER, NULL); | 272 CA_ANSWER, NULL); |
275 return result; | 273 return result; |
276 } | 274 } |
277 | 275 |
278 bool SendTerminate() { | 276 bool SendTerminate() { |
279 channel1_.reset(); | 277 channel1_.reset(); |
280 channel2_.reset(); | 278 channel2_.reset(); |
281 return true; | 279 return true; |
282 } | 280 } |
283 | 281 |
284 bool AddStream1(int id) { | 282 bool AddStream1(int id) { |
285 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 283 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
286 } | 284 } |
287 bool RemoveStream1(int id) { | 285 bool RemoveStream1(int id) { |
288 return channel1_->RemoveRecvStream(id); | 286 return channel1_->RemoveRecvStream(id); |
289 } | 287 } |
290 | 288 |
291 // Calling "_w" method here is ok since we only use one thread for this test | |
292 cricket::FakeTransport* GetTransport1() { | 289 cricket::FakeTransport* GetTransport1() { |
293 return transport_controller1_.GetTransport_w(channel1_->content_name()); | 290 return session1_.GetTransport(channel1_->content_name()); |
294 } | 291 } |
295 cricket::FakeTransport* GetTransport2() { | 292 cricket::FakeTransport* GetTransport2() { |
296 return transport_controller2_.GetTransport_w(channel2_->content_name()); | 293 return session2_.GetTransport(channel2_->content_name()); |
297 } | 294 } |
298 | 295 |
299 bool SendRtp1() { | 296 bool SendRtp1() { |
300 return media_channel1_->SendRtp(rtp_packet_.c_str(), | 297 return media_channel1_->SendRtp(rtp_packet_.c_str(), |
301 static_cast<int>(rtp_packet_.size())); | 298 static_cast<int>(rtp_packet_.size())); |
302 } | 299 } |
303 bool SendRtp2() { | 300 bool SendRtp2() { |
304 return media_channel2_->SendRtp(rtp_packet_.c_str(), | 301 return media_channel2_->SendRtp(rtp_packet_.c_str(), |
305 static_cast<int>(rtp_packet_.size())); | 302 static_cast<int>(rtp_packet_.size())); |
306 } | 303 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 CreateChannels(0, 0); | 762 CreateChannels(0, 0); |
766 typename T::Content content1; | 763 typename T::Content content1; |
767 CreateContent(0, kPcmuCodec, kH264Codec, &content1); | 764 CreateContent(0, kPcmuCodec, kH264Codec, &content1); |
768 content1.AddStream(stream1); | 765 content1.AddStream(stream1); |
769 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 766 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
770 EXPECT_TRUE(channel1_->Enable(true)); | 767 EXPECT_TRUE(channel1_->Enable(true)); |
771 EXPECT_EQ(1u, media_channel1_->send_streams().size()); | 768 EXPECT_EQ(1u, media_channel1_->send_streams().size()); |
772 | 769 |
773 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 770 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
774 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); | 771 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); |
775 transport_controller1_.Connect(&transport_controller2_); | 772 session1_.Connect(&session2_); |
776 | 773 |
777 // Channel 2 do not send anything. | 774 // Channel 2 do not send anything. |
778 typename T::Content content2; | 775 typename T::Content content2; |
779 CreateContent(0, kPcmuCodec, kH264Codec, &content2); | 776 CreateContent(0, kPcmuCodec, kH264Codec, &content2); |
780 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); | 777 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); |
781 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); | 778 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); |
782 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); | 779 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); |
783 EXPECT_TRUE(channel2_->Enable(true)); | 780 EXPECT_TRUE(channel2_->Enable(true)); |
784 EXPECT_EQ(0u, media_channel2_->send_streams().size()); | 781 EXPECT_EQ(0u, media_channel2_->send_streams().size()); |
785 | 782 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 EXPECT_TRUE(media_channel1_->playout()); | 825 EXPECT_TRUE(media_channel1_->playout()); |
829 EXPECT_FALSE(media_channel1_->sending()); | 826 EXPECT_FALSE(media_channel1_->sending()); |
830 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, | 827 EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_, |
831 CA_OFFER, NULL)); | 828 CA_OFFER, NULL)); |
832 EXPECT_FALSE(media_channel2_->playout()); | 829 EXPECT_FALSE(media_channel2_->playout()); |
833 EXPECT_FALSE(media_channel2_->sending()); | 830 EXPECT_FALSE(media_channel2_->sending()); |
834 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, | 831 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, |
835 CA_ANSWER, NULL)); | 832 CA_ANSWER, NULL)); |
836 EXPECT_FALSE(media_channel2_->playout()); | 833 EXPECT_FALSE(media_channel2_->playout()); |
837 EXPECT_FALSE(media_channel2_->sending()); | 834 EXPECT_FALSE(media_channel2_->sending()); |
838 transport_controller1_.Connect(&transport_controller2_); | 835 session1_.Connect(&session2_); |
839 EXPECT_TRUE(media_channel1_->playout()); | 836 EXPECT_TRUE(media_channel1_->playout()); |
840 EXPECT_FALSE(media_channel1_->sending()); | 837 EXPECT_FALSE(media_channel1_->sending()); |
841 EXPECT_FALSE(media_channel2_->playout()); | 838 EXPECT_FALSE(media_channel2_->playout()); |
842 EXPECT_FALSE(media_channel2_->sending()); | 839 EXPECT_FALSE(media_channel2_->sending()); |
843 EXPECT_TRUE(channel2_->Enable(true)); | 840 EXPECT_TRUE(channel2_->Enable(true)); |
844 EXPECT_TRUE(media_channel2_->playout()); | 841 EXPECT_TRUE(media_channel2_->playout()); |
845 EXPECT_TRUE(media_channel2_->sending()); | 842 EXPECT_TRUE(media_channel2_->sending()); |
846 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, | 843 EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_, |
847 CA_ANSWER, NULL)); | 844 CA_ANSWER, NULL)); |
848 EXPECT_TRUE(media_channel1_->playout()); | 845 EXPECT_TRUE(media_channel1_->playout()); |
(...skipping 15 matching lines...) Expand all Loading... |
864 EXPECT_TRUE(channel2_->Enable(true)); | 861 EXPECT_TRUE(channel2_->Enable(true)); |
865 EXPECT_FALSE(media_channel1_->playout()); | 862 EXPECT_FALSE(media_channel1_->playout()); |
866 EXPECT_FALSE(media_channel1_->sending()); | 863 EXPECT_FALSE(media_channel1_->sending()); |
867 EXPECT_FALSE(media_channel2_->playout()); | 864 EXPECT_FALSE(media_channel2_->playout()); |
868 EXPECT_FALSE(media_channel2_->sending()); | 865 EXPECT_FALSE(media_channel2_->sending()); |
869 | 866 |
870 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 867 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
871 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 868 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
872 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 869 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
873 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 870 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
874 transport_controller1_.Connect(&transport_controller2_); | 871 session1_.Connect(&session2_); |
875 | 872 |
876 EXPECT_TRUE(media_channel1_->playout()); | 873 EXPECT_TRUE(media_channel1_->playout()); |
877 EXPECT_FALSE(media_channel1_->sending()); // remote InActive | 874 EXPECT_FALSE(media_channel1_->sending()); // remote InActive |
878 EXPECT_FALSE(media_channel2_->playout()); // local InActive | 875 EXPECT_FALSE(media_channel2_->playout()); // local InActive |
879 EXPECT_FALSE(media_channel2_->sending()); // local InActive | 876 EXPECT_FALSE(media_channel2_->sending()); // local InActive |
880 | 877 |
881 // Update |content2| to be RecvOnly. | 878 // Update |content2| to be RecvOnly. |
882 content2.set_direction(cricket::MD_RECVONLY); | 879 content2.set_direction(cricket::MD_RECVONLY); |
883 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 880 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
884 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 881 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 EXPECT_TRUE(SendInitiate()); | 931 EXPECT_TRUE(SendInitiate()); |
935 EXPECT_TRUE(SendAccept()); | 932 EXPECT_TRUE(SendAccept()); |
936 EXPECT_TRUE(SendTerminate()); | 933 EXPECT_TRUE(SendTerminate()); |
937 } | 934 } |
938 | 935 |
939 // Send voice RTP data to the other side and ensure it gets there. | 936 // Send voice RTP data to the other side and ensure it gets there. |
940 void SendRtpToRtp() { | 937 void SendRtpToRtp() { |
941 CreateChannels(0, 0); | 938 CreateChannels(0, 0); |
942 EXPECT_TRUE(SendInitiate()); | 939 EXPECT_TRUE(SendInitiate()); |
943 EXPECT_TRUE(SendAccept()); | 940 EXPECT_TRUE(SendAccept()); |
944 ASSERT_TRUE(GetTransport1()); | |
945 ASSERT_TRUE(GetTransport2()); | |
946 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 941 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
947 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 942 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
948 EXPECT_TRUE(SendRtp1()); | 943 EXPECT_TRUE(SendRtp1()); |
949 EXPECT_TRUE(SendRtp2()); | 944 EXPECT_TRUE(SendRtp2()); |
950 EXPECT_TRUE(CheckRtp1()); | 945 EXPECT_TRUE(CheckRtp1()); |
951 EXPECT_TRUE(CheckRtp2()); | 946 EXPECT_TRUE(CheckRtp2()); |
952 EXPECT_TRUE(CheckNoRtp1()); | 947 EXPECT_TRUE(CheckNoRtp1()); |
953 EXPECT_TRUE(CheckNoRtp2()); | 948 EXPECT_TRUE(CheckNoRtp2()); |
954 } | 949 } |
955 | 950 |
956 // Check that RTCP is not transmitted if both sides don't support RTCP. | 951 // Check that RTCP is not transmitted if both sides don't support RTCP. |
957 void SendNoRtcpToNoRtcp() { | 952 void SendNoRtcpToNoRtcp() { |
958 CreateChannels(0, 0); | 953 CreateChannels(0, 0); |
959 EXPECT_TRUE(SendInitiate()); | 954 EXPECT_TRUE(SendInitiate()); |
960 EXPECT_TRUE(SendAccept()); | 955 EXPECT_TRUE(SendAccept()); |
961 ASSERT_TRUE(GetTransport1()); | |
962 ASSERT_TRUE(GetTransport2()); | |
963 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 956 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
964 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 957 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
965 EXPECT_FALSE(SendRtcp1()); | 958 EXPECT_FALSE(SendRtcp1()); |
966 EXPECT_FALSE(SendRtcp2()); | 959 EXPECT_FALSE(SendRtcp2()); |
967 EXPECT_TRUE(CheckNoRtcp1()); | 960 EXPECT_TRUE(CheckNoRtcp1()); |
968 EXPECT_TRUE(CheckNoRtcp2()); | 961 EXPECT_TRUE(CheckNoRtcp2()); |
969 } | 962 } |
970 | 963 |
971 // Check that RTCP is not transmitted if the callee doesn't support RTCP. | 964 // Check that RTCP is not transmitted if the callee doesn't support RTCP. |
972 void SendNoRtcpToRtcp() { | 965 void SendNoRtcpToRtcp() { |
973 CreateChannels(0, RTCP); | 966 CreateChannels(0, RTCP); |
974 EXPECT_TRUE(SendInitiate()); | 967 EXPECT_TRUE(SendInitiate()); |
975 EXPECT_TRUE(SendAccept()); | 968 EXPECT_TRUE(SendAccept()); |
976 ASSERT_TRUE(GetTransport1()); | |
977 ASSERT_TRUE(GetTransport2()); | |
978 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 969 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
979 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 970 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
980 EXPECT_FALSE(SendRtcp1()); | 971 EXPECT_FALSE(SendRtcp1()); |
981 EXPECT_FALSE(SendRtcp2()); | 972 EXPECT_FALSE(SendRtcp2()); |
982 EXPECT_TRUE(CheckNoRtcp1()); | 973 EXPECT_TRUE(CheckNoRtcp1()); |
983 EXPECT_TRUE(CheckNoRtcp2()); | 974 EXPECT_TRUE(CheckNoRtcp2()); |
984 } | 975 } |
985 | 976 |
986 // Check that RTCP is not transmitted if the caller doesn't support RTCP. | 977 // Check that RTCP is not transmitted if the caller doesn't support RTCP. |
987 void SendRtcpToNoRtcp() { | 978 void SendRtcpToNoRtcp() { |
988 CreateChannels(RTCP, 0); | 979 CreateChannels(RTCP, 0); |
989 EXPECT_TRUE(SendInitiate()); | 980 EXPECT_TRUE(SendInitiate()); |
990 EXPECT_TRUE(SendAccept()); | 981 EXPECT_TRUE(SendAccept()); |
991 ASSERT_TRUE(GetTransport1()); | |
992 ASSERT_TRUE(GetTransport2()); | |
993 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 982 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
994 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 983 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
995 EXPECT_FALSE(SendRtcp1()); | 984 EXPECT_FALSE(SendRtcp1()); |
996 EXPECT_FALSE(SendRtcp2()); | 985 EXPECT_FALSE(SendRtcp2()); |
997 EXPECT_TRUE(CheckNoRtcp1()); | 986 EXPECT_TRUE(CheckNoRtcp1()); |
998 EXPECT_TRUE(CheckNoRtcp2()); | 987 EXPECT_TRUE(CheckNoRtcp2()); |
999 } | 988 } |
1000 | 989 |
1001 // Check that RTCP is transmitted if both sides support RTCP. | 990 // Check that RTCP is transmitted if both sides support RTCP. |
1002 void SendRtcpToRtcp() { | 991 void SendRtcpToRtcp() { |
1003 CreateChannels(RTCP, RTCP); | 992 CreateChannels(RTCP, RTCP); |
1004 EXPECT_TRUE(SendInitiate()); | 993 EXPECT_TRUE(SendInitiate()); |
1005 EXPECT_TRUE(SendAccept()); | 994 EXPECT_TRUE(SendAccept()); |
1006 ASSERT_TRUE(GetTransport1()); | |
1007 ASSERT_TRUE(GetTransport2()); | |
1008 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 995 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1009 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 996 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1010 EXPECT_TRUE(SendRtcp1()); | 997 EXPECT_TRUE(SendRtcp1()); |
1011 EXPECT_TRUE(SendRtcp2()); | 998 EXPECT_TRUE(SendRtcp2()); |
1012 EXPECT_TRUE(CheckRtcp1()); | 999 EXPECT_TRUE(CheckRtcp1()); |
1013 EXPECT_TRUE(CheckRtcp2()); | 1000 EXPECT_TRUE(CheckRtcp2()); |
1014 EXPECT_TRUE(CheckNoRtcp1()); | 1001 EXPECT_TRUE(CheckNoRtcp1()); |
1015 EXPECT_TRUE(CheckNoRtcp2()); | 1002 EXPECT_TRUE(CheckNoRtcp2()); |
1016 } | 1003 } |
1017 | 1004 |
1018 // Check that RTCP is transmitted if only the initiator supports mux. | 1005 // Check that RTCP is transmitted if only the initiator supports mux. |
1019 void SendRtcpMuxToRtcp() { | 1006 void SendRtcpMuxToRtcp() { |
1020 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1007 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1021 EXPECT_TRUE(SendInitiate()); | 1008 EXPECT_TRUE(SendInitiate()); |
1022 EXPECT_TRUE(SendAccept()); | 1009 EXPECT_TRUE(SendAccept()); |
1023 ASSERT_TRUE(GetTransport1()); | |
1024 ASSERT_TRUE(GetTransport2()); | |
1025 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1010 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1026 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1011 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1027 EXPECT_TRUE(SendRtcp1()); | 1012 EXPECT_TRUE(SendRtcp1()); |
1028 EXPECT_TRUE(SendRtcp2()); | 1013 EXPECT_TRUE(SendRtcp2()); |
1029 EXPECT_TRUE(CheckRtcp1()); | 1014 EXPECT_TRUE(CheckRtcp1()); |
1030 EXPECT_TRUE(CheckRtcp2()); | 1015 EXPECT_TRUE(CheckRtcp2()); |
1031 EXPECT_TRUE(CheckNoRtcp1()); | 1016 EXPECT_TRUE(CheckNoRtcp1()); |
1032 EXPECT_TRUE(CheckNoRtcp2()); | 1017 EXPECT_TRUE(CheckNoRtcp2()); |
1033 } | 1018 } |
1034 | 1019 |
1035 // Check that RTP and RTCP are transmitted ok when both sides support mux. | 1020 // Check that RTP and RTCP are transmitted ok when both sides support mux. |
1036 void SendRtcpMuxToRtcpMux() { | 1021 void SendRtcpMuxToRtcpMux() { |
1037 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1022 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1038 EXPECT_TRUE(SendInitiate()); | 1023 EXPECT_TRUE(SendInitiate()); |
1039 ASSERT_TRUE(GetTransport1()); | |
1040 ASSERT_TRUE(GetTransport2()); | |
1041 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1024 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1042 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1025 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1043 EXPECT_TRUE(SendAccept()); | 1026 EXPECT_TRUE(SendAccept()); |
1044 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1027 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1045 EXPECT_TRUE(SendRtp1()); | 1028 EXPECT_TRUE(SendRtp1()); |
1046 EXPECT_TRUE(SendRtp2()); | 1029 EXPECT_TRUE(SendRtp2()); |
1047 EXPECT_TRUE(SendRtcp1()); | 1030 EXPECT_TRUE(SendRtcp1()); |
1048 EXPECT_TRUE(SendRtcp2()); | 1031 EXPECT_TRUE(SendRtcp2()); |
1049 EXPECT_TRUE(CheckRtp1()); | 1032 EXPECT_TRUE(CheckRtp1()); |
1050 EXPECT_TRUE(CheckRtp2()); | 1033 EXPECT_TRUE(CheckRtp2()); |
1051 EXPECT_TRUE(CheckNoRtp1()); | 1034 EXPECT_TRUE(CheckNoRtp1()); |
1052 EXPECT_TRUE(CheckNoRtp2()); | 1035 EXPECT_TRUE(CheckNoRtp2()); |
1053 EXPECT_TRUE(CheckRtcp1()); | 1036 EXPECT_TRUE(CheckRtcp1()); |
1054 EXPECT_TRUE(CheckRtcp2()); | 1037 EXPECT_TRUE(CheckRtcp2()); |
1055 EXPECT_TRUE(CheckNoRtcp1()); | 1038 EXPECT_TRUE(CheckNoRtcp1()); |
1056 EXPECT_TRUE(CheckNoRtcp2()); | 1039 EXPECT_TRUE(CheckNoRtcp2()); |
1057 } | 1040 } |
1058 | 1041 |
1059 // Check that RTP and RTCP are transmitted ok when both sides | 1042 // Check that RTP and RTCP are transmitted ok when both sides |
1060 // support mux and one the offerer requires mux. | 1043 // support mux and one the offerer requires mux. |
1061 void SendRequireRtcpMuxToRtcpMux() { | 1044 void SendRequireRtcpMuxToRtcpMux() { |
1062 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1045 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1063 channel1_->ActivateRtcpMux(); | 1046 channel1_->ActivateRtcpMux(); |
1064 EXPECT_TRUE(SendInitiate()); | 1047 EXPECT_TRUE(SendInitiate()); |
1065 ASSERT_TRUE(GetTransport1()); | |
1066 ASSERT_TRUE(GetTransport2()); | |
1067 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1048 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1068 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1049 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1069 EXPECT_TRUE(SendAccept()); | 1050 EXPECT_TRUE(SendAccept()); |
1070 EXPECT_TRUE(SendRtp1()); | 1051 EXPECT_TRUE(SendRtp1()); |
1071 EXPECT_TRUE(SendRtp2()); | 1052 EXPECT_TRUE(SendRtp2()); |
1072 EXPECT_TRUE(SendRtcp1()); | 1053 EXPECT_TRUE(SendRtcp1()); |
1073 EXPECT_TRUE(SendRtcp2()); | 1054 EXPECT_TRUE(SendRtcp2()); |
1074 EXPECT_TRUE(CheckRtp1()); | 1055 EXPECT_TRUE(CheckRtp1()); |
1075 EXPECT_TRUE(CheckRtp2()); | 1056 EXPECT_TRUE(CheckRtp2()); |
1076 EXPECT_TRUE(CheckNoRtp1()); | 1057 EXPECT_TRUE(CheckNoRtp1()); |
1077 EXPECT_TRUE(CheckNoRtp2()); | 1058 EXPECT_TRUE(CheckNoRtp2()); |
1078 EXPECT_TRUE(CheckRtcp1()); | 1059 EXPECT_TRUE(CheckRtcp1()); |
1079 EXPECT_TRUE(CheckRtcp2()); | 1060 EXPECT_TRUE(CheckRtcp2()); |
1080 EXPECT_TRUE(CheckNoRtcp1()); | 1061 EXPECT_TRUE(CheckNoRtcp1()); |
1081 EXPECT_TRUE(CheckNoRtcp2()); | 1062 EXPECT_TRUE(CheckNoRtcp2()); |
1082 } | 1063 } |
1083 | 1064 |
1084 // Check that RTP and RTCP are transmitted ok when both sides | 1065 // Check that RTP and RTCP are transmitted ok when both sides |
1085 // support mux and one the answerer requires rtcp mux. | 1066 // support mux and one the answerer requires rtcp mux. |
1086 void SendRtcpMuxToRequireRtcpMux() { | 1067 void SendRtcpMuxToRequireRtcpMux() { |
1087 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1068 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1088 channel2_->ActivateRtcpMux(); | 1069 channel2_->ActivateRtcpMux(); |
1089 EXPECT_TRUE(SendInitiate()); | 1070 EXPECT_TRUE(SendInitiate()); |
1090 ASSERT_TRUE(GetTransport1()); | |
1091 ASSERT_TRUE(GetTransport2()); | |
1092 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1071 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1093 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1072 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1094 EXPECT_TRUE(SendAccept()); | 1073 EXPECT_TRUE(SendAccept()); |
1095 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1074 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1096 EXPECT_TRUE(SendRtp1()); | 1075 EXPECT_TRUE(SendRtp1()); |
1097 EXPECT_TRUE(SendRtp2()); | 1076 EXPECT_TRUE(SendRtp2()); |
1098 EXPECT_TRUE(SendRtcp1()); | 1077 EXPECT_TRUE(SendRtcp1()); |
1099 EXPECT_TRUE(SendRtcp2()); | 1078 EXPECT_TRUE(SendRtcp2()); |
1100 EXPECT_TRUE(CheckRtp1()); | 1079 EXPECT_TRUE(CheckRtp1()); |
1101 EXPECT_TRUE(CheckRtp2()); | 1080 EXPECT_TRUE(CheckRtp2()); |
1102 EXPECT_TRUE(CheckNoRtp1()); | 1081 EXPECT_TRUE(CheckNoRtp1()); |
1103 EXPECT_TRUE(CheckNoRtp2()); | 1082 EXPECT_TRUE(CheckNoRtp2()); |
1104 EXPECT_TRUE(CheckRtcp1()); | 1083 EXPECT_TRUE(CheckRtcp1()); |
1105 EXPECT_TRUE(CheckRtcp2()); | 1084 EXPECT_TRUE(CheckRtcp2()); |
1106 EXPECT_TRUE(CheckNoRtcp1()); | 1085 EXPECT_TRUE(CheckNoRtcp1()); |
1107 EXPECT_TRUE(CheckNoRtcp2()); | 1086 EXPECT_TRUE(CheckNoRtcp2()); |
1108 } | 1087 } |
1109 | 1088 |
1110 // Check that RTP and RTCP are transmitted ok when both sides | 1089 // Check that RTP and RTCP are transmitted ok when both sides |
1111 // require mux. | 1090 // require mux. |
1112 void SendRequireRtcpMuxToRequireRtcpMux() { | 1091 void SendRequireRtcpMuxToRequireRtcpMux() { |
1113 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1092 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1114 channel1_->ActivateRtcpMux(); | 1093 channel1_->ActivateRtcpMux(); |
1115 channel2_->ActivateRtcpMux(); | 1094 channel2_->ActivateRtcpMux(); |
1116 EXPECT_TRUE(SendInitiate()); | 1095 EXPECT_TRUE(SendInitiate()); |
1117 ASSERT_TRUE(GetTransport1()); | |
1118 ASSERT_TRUE(GetTransport2()); | |
1119 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1096 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1120 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1097 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1121 EXPECT_TRUE(SendAccept()); | 1098 EXPECT_TRUE(SendAccept()); |
1122 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1099 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1123 EXPECT_TRUE(SendRtp1()); | 1100 EXPECT_TRUE(SendRtp1()); |
1124 EXPECT_TRUE(SendRtp2()); | 1101 EXPECT_TRUE(SendRtp2()); |
1125 EXPECT_TRUE(SendRtcp1()); | 1102 EXPECT_TRUE(SendRtcp1()); |
1126 EXPECT_TRUE(SendRtcp2()); | 1103 EXPECT_TRUE(SendRtcp2()); |
1127 EXPECT_TRUE(CheckRtp1()); | 1104 EXPECT_TRUE(CheckRtp1()); |
1128 EXPECT_TRUE(CheckRtp2()); | 1105 EXPECT_TRUE(CheckRtp2()); |
1129 EXPECT_TRUE(CheckNoRtp1()); | 1106 EXPECT_TRUE(CheckNoRtp1()); |
1130 EXPECT_TRUE(CheckNoRtp2()); | 1107 EXPECT_TRUE(CheckNoRtp2()); |
1131 EXPECT_TRUE(CheckRtcp1()); | 1108 EXPECT_TRUE(CheckRtcp1()); |
1132 EXPECT_TRUE(CheckRtcp2()); | 1109 EXPECT_TRUE(CheckRtcp2()); |
1133 EXPECT_TRUE(CheckNoRtcp1()); | 1110 EXPECT_TRUE(CheckNoRtcp1()); |
1134 EXPECT_TRUE(CheckNoRtcp2()); | 1111 EXPECT_TRUE(CheckNoRtcp2()); |
1135 } | 1112 } |
1136 | 1113 |
1137 // Check that SendAccept fails if the answerer doesn't support mux | 1114 // Check that SendAccept fails if the answerer doesn't support mux |
1138 // and the offerer requires it. | 1115 // and the offerer requires it. |
1139 void SendRequireRtcpMuxToNoRtcpMux() { | 1116 void SendRequireRtcpMuxToNoRtcpMux() { |
1140 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1117 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1141 channel1_->ActivateRtcpMux(); | 1118 channel1_->ActivateRtcpMux(); |
1142 EXPECT_TRUE(SendInitiate()); | 1119 EXPECT_TRUE(SendInitiate()); |
1143 ASSERT_TRUE(GetTransport1()); | |
1144 ASSERT_TRUE(GetTransport2()); | |
1145 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1120 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1146 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1121 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1147 EXPECT_FALSE(SendAccept()); | 1122 EXPECT_FALSE(SendAccept()); |
1148 } | 1123 } |
1149 | 1124 |
1150 // Check that RTCP data sent by the initiator before the accept is not muxed. | 1125 // Check that RTCP data sent by the initiator before the accept is not muxed. |
1151 void SendEarlyRtcpMuxToRtcp() { | 1126 void SendEarlyRtcpMuxToRtcp() { |
1152 CreateChannels(RTCP | RTCP_MUX, RTCP); | 1127 CreateChannels(RTCP | RTCP_MUX, RTCP); |
1153 EXPECT_TRUE(SendInitiate()); | 1128 EXPECT_TRUE(SendInitiate()); |
1154 ASSERT_TRUE(GetTransport1()); | |
1155 ASSERT_TRUE(GetTransport2()); | |
1156 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1129 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1157 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1130 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1158 | 1131 |
1159 // RTCP can be sent before the call is accepted, if the transport is ready. | 1132 // RTCP can be sent before the call is accepted, if the transport is ready. |
1160 // It should not be muxed though, as the remote side doesn't support mux. | 1133 // It should not be muxed though, as the remote side doesn't support mux. |
1161 EXPECT_TRUE(SendRtcp1()); | 1134 EXPECT_TRUE(SendRtcp1()); |
1162 EXPECT_TRUE(CheckNoRtp2()); | 1135 EXPECT_TRUE(CheckNoRtp2()); |
1163 EXPECT_TRUE(CheckRtcp2()); | 1136 EXPECT_TRUE(CheckRtcp2()); |
1164 | 1137 |
1165 // Send RTCP packet from callee and verify that it is received. | 1138 // Send RTCP packet from callee and verify that it is received. |
(...skipping 10 matching lines...) Expand all Loading... |
1176 EXPECT_TRUE(CheckRtcp1()); | 1149 EXPECT_TRUE(CheckRtcp1()); |
1177 } | 1150 } |
1178 | 1151 |
1179 | 1152 |
1180 // Check that RTCP data is not muxed until both sides have enabled muxing, | 1153 // Check that RTCP data is not muxed until both sides have enabled muxing, |
1181 // but that we properly demux before we get the accept message, since there | 1154 // but that we properly demux before we get the accept message, since there |
1182 // is a race between RTP data and the jingle accept. | 1155 // is a race between RTP data and the jingle accept. |
1183 void SendEarlyRtcpMuxToRtcpMux() { | 1156 void SendEarlyRtcpMuxToRtcpMux() { |
1184 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); | 1157 CreateChannels(RTCP | RTCP_MUX, RTCP | RTCP_MUX); |
1185 EXPECT_TRUE(SendInitiate()); | 1158 EXPECT_TRUE(SendInitiate()); |
1186 ASSERT_TRUE(GetTransport1()); | |
1187 ASSERT_TRUE(GetTransport2()); | |
1188 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1159 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1189 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1160 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1190 | 1161 |
1191 // RTCP can't be sent yet, since the RTCP transport isn't writable, and | 1162 // RTCP can't be sent yet, since the RTCP transport isn't writable, and |
1192 // we haven't yet received the accept that says we should mux. | 1163 // we haven't yet received the accept that says we should mux. |
1193 EXPECT_FALSE(SendRtcp1()); | 1164 EXPECT_FALSE(SendRtcp1()); |
1194 | 1165 |
1195 // Send muxed RTCP packet from callee and verify that it is received. | 1166 // Send muxed RTCP packet from callee and verify that it is received. |
1196 EXPECT_TRUE(SendRtcp2()); | 1167 EXPECT_TRUE(SendRtcp2()); |
1197 EXPECT_TRUE(CheckNoRtp1()); | 1168 EXPECT_TRUE(CheckNoRtp1()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. | 1239 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. |
1269 void SendEarlyMediaUsingRtcpMuxSrtp() { | 1240 void SendEarlyMediaUsingRtcpMuxSrtp() { |
1270 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1241 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
1271 | 1242 |
1272 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, | 1243 CreateChannels(SSRC_MUX | RTCP | RTCP_MUX | SECURE, |
1273 SSRC_MUX | RTCP | RTCP_MUX | SECURE); | 1244 SSRC_MUX | RTCP | RTCP_MUX | SECURE); |
1274 EXPECT_TRUE(SendOffer()); | 1245 EXPECT_TRUE(SendOffer()); |
1275 EXPECT_TRUE(SendProvisionalAnswer()); | 1246 EXPECT_TRUE(SendProvisionalAnswer()); |
1276 EXPECT_TRUE(channel1_->secure()); | 1247 EXPECT_TRUE(channel1_->secure()); |
1277 EXPECT_TRUE(channel2_->secure()); | 1248 EXPECT_TRUE(channel2_->secure()); |
1278 ASSERT_TRUE(GetTransport1()); | |
1279 ASSERT_TRUE(GetTransport2()); | |
1280 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1249 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1281 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1250 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1282 EXPECT_TRUE(SendCustomRtcp1(kSsrc1)); | 1251 EXPECT_TRUE(SendCustomRtcp1(kSsrc1)); |
1283 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1252 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
1284 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1)); | 1253 EXPECT_TRUE(SendCustomRtp1(kSsrc1, ++sequence_number1_1)); |
1285 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1254 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
1286 | 1255 |
1287 // Send packets from callee and verify that it is received. | 1256 // Send packets from callee and verify that it is received. |
1288 EXPECT_TRUE(SendCustomRtcp2(kSsrc2)); | 1257 EXPECT_TRUE(SendCustomRtcp2(kSsrc2)); |
1289 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1258 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 EXPECT_TRUE(CheckNoRtcp1()); | 1322 EXPECT_TRUE(CheckNoRtcp1()); |
1354 EXPECT_TRUE(CheckNoRtcp2()); | 1323 EXPECT_TRUE(CheckNoRtcp2()); |
1355 } | 1324 } |
1356 | 1325 |
1357 // Test that the mediachannel retains its sending state after the transport | 1326 // Test that the mediachannel retains its sending state after the transport |
1358 // becomes non-writable. | 1327 // becomes non-writable. |
1359 void SendWithWritabilityLoss() { | 1328 void SendWithWritabilityLoss() { |
1360 CreateChannels(0, 0); | 1329 CreateChannels(0, 0); |
1361 EXPECT_TRUE(SendInitiate()); | 1330 EXPECT_TRUE(SendInitiate()); |
1362 EXPECT_TRUE(SendAccept()); | 1331 EXPECT_TRUE(SendAccept()); |
1363 ASSERT_TRUE(GetTransport1()); | |
1364 ASSERT_TRUE(GetTransport2()); | |
1365 EXPECT_EQ(1U, GetTransport1()->channels().size()); | 1332 EXPECT_EQ(1U, GetTransport1()->channels().size()); |
1366 EXPECT_EQ(1U, GetTransport2()->channels().size()); | 1333 EXPECT_EQ(1U, GetTransport2()->channels().size()); |
1367 EXPECT_TRUE(SendRtp1()); | 1334 EXPECT_TRUE(SendRtp1()); |
1368 EXPECT_TRUE(SendRtp2()); | 1335 EXPECT_TRUE(SendRtp2()); |
1369 EXPECT_TRUE(CheckRtp1()); | 1336 EXPECT_TRUE(CheckRtp1()); |
1370 EXPECT_TRUE(CheckRtp2()); | 1337 EXPECT_TRUE(CheckRtp2()); |
1371 EXPECT_TRUE(CheckNoRtp1()); | 1338 EXPECT_TRUE(CheckNoRtp1()); |
1372 EXPECT_TRUE(CheckNoRtp2()); | 1339 EXPECT_TRUE(CheckNoRtp2()); |
1373 | 1340 |
1374 // Lose writability, which should fail. | 1341 // Lose writability, which should fail. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 int pl_type2 = pl_types[1]; | 1386 int pl_type2 = pl_types[1]; |
1420 int flags = SSRC_MUX | RTCP; | 1387 int flags = SSRC_MUX | RTCP; |
1421 if (secure) flags |= SECURE; | 1388 if (secure) flags |= SECURE; |
1422 uint32 expected_channels = 2U; | 1389 uint32 expected_channels = 2U; |
1423 if (rtcp_mux) { | 1390 if (rtcp_mux) { |
1424 flags |= RTCP_MUX; | 1391 flags |= RTCP_MUX; |
1425 expected_channels = 1U; | 1392 expected_channels = 1U; |
1426 } | 1393 } |
1427 CreateChannels(flags, flags); | 1394 CreateChannels(flags, flags); |
1428 EXPECT_TRUE(SendInitiate()); | 1395 EXPECT_TRUE(SendInitiate()); |
1429 ASSERT_TRUE(GetTransport1()); | |
1430 ASSERT_TRUE(GetTransport2()); | |
1431 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1396 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1432 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); | 1397 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1433 EXPECT_TRUE(SendAccept()); | 1398 EXPECT_TRUE(SendAccept()); |
1434 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); | 1399 EXPECT_EQ(expected_channels, GetTransport1()->channels().size()); |
1435 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); | 1400 EXPECT_EQ(expected_channels, GetTransport2()->channels().size()); |
1436 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); | 1401 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); |
1437 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); | 1402 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); |
1438 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); | 1403 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); |
1439 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); | 1404 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); |
1440 // channel1 - should only have media_content2 as remote. i.e. kSsrc2 | 1405 // channel1 - should only have media_content2 as remote. i.e. kSsrc2 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); | 1574 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); |
1610 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); | 1575 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); |
1611 } | 1576 } |
1612 | 1577 |
1613 void TestFlushRtcp() { | 1578 void TestFlushRtcp() { |
1614 bool send_rtcp1; | 1579 bool send_rtcp1; |
1615 | 1580 |
1616 CreateChannels(RTCP, RTCP); | 1581 CreateChannels(RTCP, RTCP); |
1617 EXPECT_TRUE(SendInitiate()); | 1582 EXPECT_TRUE(SendInitiate()); |
1618 EXPECT_TRUE(SendAccept()); | 1583 EXPECT_TRUE(SendAccept()); |
1619 ASSERT_TRUE(GetTransport1()); | |
1620 ASSERT_TRUE(GetTransport2()); | |
1621 EXPECT_EQ(2U, GetTransport1()->channels().size()); | 1584 EXPECT_EQ(2U, GetTransport1()->channels().size()); |
1622 EXPECT_EQ(2U, GetTransport2()->channels().size()); | 1585 EXPECT_EQ(2U, GetTransport2()->channels().size()); |
1623 | 1586 |
1624 // Send RTCP1 from a different thread. | 1587 // Send RTCP1 from a different thread. |
1625 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1); | 1588 CallOnThreadAndWaitForDone(&ChannelTest<T>::SendRtcp1, &send_rtcp1); |
1626 EXPECT_TRUE(send_rtcp1); | 1589 EXPECT_TRUE(send_rtcp1); |
1627 // The sending message is only posted. channel2_ should be empty. | 1590 // The sending message is only posted. channel2_ should be empty. |
1628 EXPECT_TRUE(CheckNoRtcp2()); | 1591 EXPECT_TRUE(CheckNoRtcp2()); |
1629 | 1592 |
1630 // When channel1_ is deleted, the RTCP packet should be sent out to | 1593 // 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... |
1699 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); | 1662 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); |
1700 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1663 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1701 rtp->SignalReadyToSend(rtp); | 1664 rtp->SignalReadyToSend(rtp); |
1702 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1665 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1703 rtcp->SignalReadyToSend(rtcp); | 1666 rtcp->SignalReadyToSend(rtcp); |
1704 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp | 1667 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp |
1705 // channel are ready to send. | 1668 // channel are ready to send. |
1706 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1669 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1707 | 1670 |
1708 // rtp channel becomes not ready to send will be propagated to mediachannel | 1671 // rtp channel becomes not ready to send will be propagated to mediachannel |
1709 channel1_->SetReadyToSend(false, false); | 1672 channel1_->SetReadyToSend(rtp, false); |
1710 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1673 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1711 channel1_->SetReadyToSend(false, true); | 1674 channel1_->SetReadyToSend(rtp, true); |
1712 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1675 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1713 | 1676 |
1714 // rtcp channel becomes not ready to send will be propagated to mediachannel | 1677 // rtcp channel becomes not ready to send will be propagated to mediachannel |
1715 channel1_->SetReadyToSend(true, false); | 1678 channel1_->SetReadyToSend(rtcp, false); |
1716 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1679 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1717 channel1_->SetReadyToSend(true, true); | 1680 channel1_->SetReadyToSend(rtcp, true); |
1718 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1681 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1719 } | 1682 } |
1720 | 1683 |
1721 void TestOnReadyToSendWithRtcpMux() { | 1684 void TestOnReadyToSendWithRtcpMux() { |
1722 CreateChannels(RTCP, RTCP); | 1685 CreateChannels(RTCP, RTCP); |
1723 typename T::Content content; | 1686 typename T::Content content; |
1724 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1687 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1725 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1688 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
1726 content.set_rtcp_mux(true); | 1689 content.set_rtcp_mux(true); |
1727 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1690 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
1728 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1691 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
1729 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 1692 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); |
1730 TransportChannel* rtp = channel1_->transport_channel(); | 1693 TransportChannel* rtp = channel1_->transport_channel(); |
1731 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1694 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1732 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1695 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1733 // should trigger the MediaChannel's OnReadyToSend. | 1696 // should trigger the MediaChannel's OnReadyToSend. |
1734 rtp->SignalReadyToSend(rtp); | 1697 rtp->SignalReadyToSend(rtp); |
1735 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1698 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1736 channel1_->SetReadyToSend(false, false); | 1699 channel1_->SetReadyToSend(rtp, false); |
1737 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1700 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1738 } | 1701 } |
1739 | 1702 |
1740 protected: | 1703 protected: |
1741 cricket::FakeTransportController transport_controller1_; | 1704 cricket::FakeSession session1_; |
1742 cricket::FakeTransportController transport_controller2_; | 1705 cricket::FakeSession session2_; |
1743 cricket::FakeMediaEngine media_engine_; | 1706 cricket::FakeMediaEngine media_engine_; |
1744 // The media channels are owned by the voice channel objects below. | 1707 // The media channels are owned by the voice channel objects below. |
1745 typename T::MediaChannel* media_channel1_; | 1708 typename T::MediaChannel* media_channel1_; |
1746 typename T::MediaChannel* media_channel2_; | 1709 typename T::MediaChannel* media_channel2_; |
1747 rtc::scoped_ptr<typename T::Channel> channel1_; | 1710 rtc::scoped_ptr<typename T::Channel> channel1_; |
1748 rtc::scoped_ptr<typename T::Channel> channel2_; | 1711 rtc::scoped_ptr<typename T::Channel> channel2_; |
1749 typename T::Content local_media_content1_; | 1712 typename T::Content local_media_content1_; |
1750 typename T::Content local_media_content2_; | 1713 typename T::Content local_media_content2_; |
1751 typename T::Content remote_media_content1_; | 1714 typename T::Content remote_media_content1_; |
1752 typename T::Content remote_media_content2_; | 1715 typename T::Content remote_media_content2_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 template<> | 1756 template<> |
1794 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent( | 1757 void ChannelTest<VoiceTraits>::AddLegacyStreamInContent( |
1795 uint32 ssrc, int flags, cricket::AudioContentDescription* audio) { | 1758 uint32 ssrc, int flags, cricket::AudioContentDescription* audio) { |
1796 audio->AddLegacyStream(ssrc); | 1759 audio->AddLegacyStream(ssrc); |
1797 } | 1760 } |
1798 | 1761 |
1799 class VoiceChannelTest | 1762 class VoiceChannelTest |
1800 : public ChannelTest<VoiceTraits> { | 1763 : public ChannelTest<VoiceTraits> { |
1801 public: | 1764 public: |
1802 typedef ChannelTest<VoiceTraits> Base; | 1765 typedef ChannelTest<VoiceTraits> Base; |
1803 VoiceChannelTest() | 1766 VoiceChannelTest() : Base(kPcmuFrame, sizeof(kPcmuFrame), |
1804 : Base(kPcmuFrame, sizeof(kPcmuFrame), kRtcpReport, sizeof(kRtcpReport)) { | 1767 kRtcpReport, sizeof(kRtcpReport)) {} |
1805 } | |
1806 }; | 1768 }; |
1807 | 1769 |
1808 // override to add NULL parameter | 1770 // override to add NULL parameter |
1809 template <> | 1771 template<> |
1810 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1772 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
1811 rtc::Thread* thread, | 1773 rtc::Thread* thread, cricket::MediaEngineInterface* engine, |
1812 cricket::MediaEngineInterface* engine, | 1774 cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session, |
1813 cricket::FakeVideoMediaChannel* ch, | |
1814 cricket::TransportController* transport_controller, | |
1815 bool rtcp) { | 1775 bool rtcp) { |
1816 cricket::VideoChannel* channel = new cricket::VideoChannel( | 1776 cricket::VideoChannel* channel = new cricket::VideoChannel( |
1817 thread, ch, transport_controller, cricket::CN_VIDEO, rtcp); | 1777 thread, ch, session, cricket::CN_VIDEO, rtcp); |
1818 if (!channel->Init()) { | 1778 if (!channel->Init()) { |
1819 delete channel; | 1779 delete channel; |
1820 channel = NULL; | 1780 channel = NULL; |
1821 } | 1781 } |
1822 return channel; | 1782 return channel; |
1823 } | 1783 } |
1824 | 1784 |
1825 // override to add 0 parameter | 1785 // override to add 0 parameter |
1826 template<> | 1786 template<> |
1827 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 1787 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 template<> | 1820 template<> |
1861 void ChannelTest<VideoTraits>::AddLegacyStreamInContent( | 1821 void ChannelTest<VideoTraits>::AddLegacyStreamInContent( |
1862 uint32 ssrc, int flags, cricket::VideoContentDescription* video) { | 1822 uint32 ssrc, int flags, cricket::VideoContentDescription* video) { |
1863 video->AddLegacyStream(ssrc); | 1823 video->AddLegacyStream(ssrc); |
1864 } | 1824 } |
1865 | 1825 |
1866 class VideoChannelTest | 1826 class VideoChannelTest |
1867 : public ChannelTest<VideoTraits> { | 1827 : public ChannelTest<VideoTraits> { |
1868 public: | 1828 public: |
1869 typedef ChannelTest<VideoTraits> Base; | 1829 typedef ChannelTest<VideoTraits> Base; |
1870 VideoChannelTest() | 1830 VideoChannelTest() : Base(kH264Packet, sizeof(kH264Packet), |
1871 : Base(kH264Packet, | 1831 kRtcpReport, sizeof(kRtcpReport)) {} |
1872 sizeof(kH264Packet), | |
1873 kRtcpReport, | |
1874 sizeof(kRtcpReport)) {} | |
1875 }; | 1832 }; |
1876 | 1833 |
1877 | 1834 |
1878 // VoiceChannelTest | 1835 // VoiceChannelTest |
1879 | 1836 |
1880 TEST_F(VoiceChannelTest, TestInit) { | 1837 TEST_F(VoiceChannelTest, TestInit) { |
1881 Base::TestInit(); | 1838 Base::TestInit(); |
1882 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 1839 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
1883 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); | 1840 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); |
1884 } | 1841 } |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 : public ChannelTest<DataTraits> { | 2539 : public ChannelTest<DataTraits> { |
2583 public: | 2540 public: |
2584 typedef ChannelTest<DataTraits> | 2541 typedef ChannelTest<DataTraits> |
2585 Base; | 2542 Base; |
2586 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), | 2543 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), |
2587 kRtcpReport, sizeof(kRtcpReport)) { | 2544 kRtcpReport, sizeof(kRtcpReport)) { |
2588 } | 2545 } |
2589 }; | 2546 }; |
2590 | 2547 |
2591 // Override to avoid engine channel parameter. | 2548 // Override to avoid engine channel parameter. |
2592 template <> | 2549 template<> |
2593 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( | 2550 cricket::DataChannel* ChannelTest<DataTraits>::CreateChannel( |
2594 rtc::Thread* thread, | 2551 rtc::Thread* thread, cricket::MediaEngineInterface* engine, |
2595 cricket::MediaEngineInterface* engine, | 2552 cricket::FakeDataMediaChannel* ch, cricket::BaseSession* session, |
2596 cricket::FakeDataMediaChannel* ch, | |
2597 cricket::TransportController* transport_controller, | |
2598 bool rtcp) { | 2553 bool rtcp) { |
2599 cricket::DataChannel* channel = new cricket::DataChannel( | 2554 cricket::DataChannel* channel = new cricket::DataChannel( |
2600 thread, ch, transport_controller, cricket::CN_DATA, rtcp); | 2555 thread, ch, session, cricket::CN_DATA, rtcp); |
2601 if (!channel->Init()) { | 2556 if (!channel->Init()) { |
2602 delete channel; | 2557 delete channel; |
2603 channel = NULL; | 2558 channel = NULL; |
2604 } | 2559 } |
2605 return channel; | 2560 return channel; |
2606 } | 2561 } |
2607 | 2562 |
2608 template<> | 2563 template<> |
2609 void ChannelTest<DataTraits>::CreateContent( | 2564 void ChannelTest<DataTraits>::CreateContent( |
2610 int flags, | 2565 int flags, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 }; | 2731 }; |
2777 rtc::Buffer payload(data, 3); | 2732 rtc::Buffer payload(data, 3); |
2778 cricket::SendDataResult result; | 2733 cricket::SendDataResult result; |
2779 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2734 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
2780 EXPECT_EQ(params.ssrc, | 2735 EXPECT_EQ(params.ssrc, |
2781 media_channel1_->last_sent_data_params().ssrc); | 2736 media_channel1_->last_sent_data_params().ssrc); |
2782 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2737 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
2783 } | 2738 } |
2784 | 2739 |
2785 // TODO(pthatcher): TestSetReceiver? | 2740 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |