| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "webrtc/base/array_view.h" | 13 #include "webrtc/base/array_view.h" |
| 14 #include "webrtc/base/buffer.h" | 14 #include "webrtc/base/buffer.h" |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/base/fakeclock.h" | 16 #include "webrtc/base/fakeclock.h" |
| 17 #include "webrtc/base/gunit.h" | 17 #include "webrtc/base/gunit.h" |
| 18 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
| 19 #include "webrtc/base/sslstreamadapter.h" | 19 #include "webrtc/base/sslstreamadapter.h" |
| 20 #include "webrtc/media/base/fakemediaengine.h" | 20 #include "webrtc/media/base/fakemediaengine.h" |
| 21 #include "webrtc/media/base/fakertp.h" | 21 #include "webrtc/media/base/fakertp.h" |
| 22 #include "webrtc/media/base/mediachannel.h" | 22 #include "webrtc/media/base/mediachannel.h" |
| 23 #include "webrtc/media/base/testutils.h" | 23 #include "webrtc/media/base/testutils.h" |
| 24 #include "webrtc/p2p/base/dtlstransportinternal.h" | 24 #include "webrtc/p2p/base/fakecandidatepair.h" |
| 25 #include "webrtc/p2p/base/faketransportcontroller.h" | 25 #include "webrtc/p2p/base/fakedtlstransport.h" |
| 26 #include "webrtc/p2p/base/fakepackettransport.h" |
| 26 #include "webrtc/pc/channel.h" | 27 #include "webrtc/pc/channel.h" |
| 27 | 28 |
| 28 #define MAYBE_SKIP_TEST(feature) \ | 29 #define MAYBE_SKIP_TEST(feature) \ |
| 29 if (!(rtc::SSLStreamAdapter::feature())) { \ | 30 if (!(rtc::SSLStreamAdapter::feature())) { \ |
| 30 LOG(LS_INFO) << "Feature disabled... skipping"; \ | 31 LOG(LS_INFO) << "Feature disabled... skipping"; \ |
| 31 return; \ | 32 return; \ |
| 32 } | 33 } |
| 33 | 34 |
| 34 using cricket::CA_OFFER; | 35 using cricket::CA_OFFER; |
| 35 using cricket::CA_PRANSWER; | 36 using cricket::CA_PRANSWER; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Base class for Voice/Video/RtpDataChannel tests | 96 // Base class for Voice/Video/RtpDataChannel tests |
| 96 template<class T> | 97 template<class T> |
| 97 class ChannelTest : public testing::Test, public sigslot::has_slots<> { | 98 class ChannelTest : public testing::Test, public sigslot::has_slots<> { |
| 98 public: | 99 public: |
| 99 enum Flags { | 100 enum Flags { |
| 100 RTCP_MUX = 0x1, | 101 RTCP_MUX = 0x1, |
| 101 RTCP_MUX_REQUIRED = 0x2, | 102 RTCP_MUX_REQUIRED = 0x2, |
| 102 SECURE = 0x4, | 103 SECURE = 0x4, |
| 103 SSRC_MUX = 0x8, | 104 SSRC_MUX = 0x8, |
| 104 DTLS = 0x10, | 105 DTLS = 0x10, |
| 105 GCM_CIPHER = 0x20 | 106 GCM_CIPHER = 0x20, |
| 107 // Use BaseChannel with PacketTransportInterface rather than |
| 108 // DtlsTransportInternal. |
| 109 RAW_PACKET_TRANSPORT = 0x40, |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 ChannelTest(bool verify_playout, | 112 ChannelTest(bool verify_playout, |
| 109 rtc::ArrayView<const uint8_t> rtp_data, | 113 rtc::ArrayView<const uint8_t> rtp_data, |
| 110 rtc::ArrayView<const uint8_t> rtcp_data, | 114 rtc::ArrayView<const uint8_t> rtcp_data, |
| 111 NetworkIsWorker network_is_worker) | 115 NetworkIsWorker network_is_worker) |
| 112 : verify_playout_(verify_playout), | 116 : verify_playout_(verify_playout), |
| 113 media_channel1_(NULL), | |
| 114 media_channel2_(NULL), | |
| 115 rtp_packet_(rtp_data.data(), rtp_data.size()), | 117 rtp_packet_(rtp_data.data(), rtp_data.size()), |
| 116 rtcp_packet_(rtcp_data.data(), rtcp_data.size()), | 118 rtcp_packet_(rtcp_data.data(), rtcp_data.size()) { |
| 117 media_info_callbacks1_(), | |
| 118 media_info_callbacks2_() { | |
| 119 if (network_is_worker == NetworkIsWorker::Yes) { | 119 if (network_is_worker == NetworkIsWorker::Yes) { |
| 120 network_thread_ = rtc::Thread::Current(); | 120 network_thread_ = rtc::Thread::Current(); |
| 121 } else { | 121 } else { |
| 122 network_thread_keeper_ = rtc::Thread::Create(); | 122 network_thread_keeper_ = rtc::Thread::Create(); |
| 123 network_thread_keeper_->SetName("Network", nullptr); | 123 network_thread_keeper_->SetName("Network", nullptr); |
| 124 network_thread_keeper_->Start(); | 124 network_thread_keeper_->Start(); |
| 125 network_thread_ = network_thread_keeper_.get(); | 125 network_thread_ = network_thread_keeper_.get(); |
| 126 } | 126 } |
| 127 transport_controller1_.reset(new cricket::FakeTransportController( | |
| 128 network_thread_, cricket::ICEROLE_CONTROLLING)); | |
| 129 transport_controller2_.reset(new cricket::FakeTransportController( | |
| 130 network_thread_, cricket::ICEROLE_CONTROLLED)); | |
| 131 } | 127 } |
| 132 | 128 |
| 133 void CreateChannels(int flags1, int flags2) { | 129 void CreateChannels(int flags1, int flags2) { |
| 134 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), | 130 CreateChannels(new typename T::MediaChannel(NULL, typename T::Options()), |
| 135 new typename T::MediaChannel(NULL, typename T::Options()), | 131 new typename T::MediaChannel(NULL, typename T::Options()), |
| 136 flags1, flags2); | 132 flags1, flags2); |
| 137 } | 133 } |
| 138 void CreateChannels(typename T::MediaChannel* ch1, | 134 void CreateChannels(typename T::MediaChannel* ch1, |
| 139 typename T::MediaChannel* ch2, | 135 typename T::MediaChannel* ch2, |
| 140 int flags1, | 136 int flags1, |
| 141 int flags2) { | 137 int flags2) { |
| 142 // Make sure RTCP_MUX_REQUIRED isn't set without RTCP_MUX. | 138 // Make sure RTCP_MUX_REQUIRED isn't set without RTCP_MUX. |
| 143 ASSERT_NE(RTCP_MUX_REQUIRED, flags1 & (RTCP_MUX | RTCP_MUX_REQUIRED)); | 139 RTC_DCHECK_NE(RTCP_MUX_REQUIRED, flags1 & (RTCP_MUX | RTCP_MUX_REQUIRED)); |
| 144 ASSERT_NE(RTCP_MUX_REQUIRED, flags2 & (RTCP_MUX | RTCP_MUX_REQUIRED)); | 140 RTC_DCHECK_NE(RTCP_MUX_REQUIRED, flags2 & (RTCP_MUX | RTCP_MUX_REQUIRED)); |
| 141 // Make sure if using raw packet transports, they're used for both |
| 142 // channels. |
| 143 RTC_DCHECK_EQ(flags1 & RAW_PACKET_TRANSPORT, flags2 & RAW_PACKET_TRANSPORT); |
| 145 rtc::Thread* worker_thread = rtc::Thread::Current(); | 144 rtc::Thread* worker_thread = rtc::Thread::Current(); |
| 146 media_channel1_ = ch1; | 145 media_channel1_ = ch1; |
| 147 media_channel2_ = ch2; | 146 media_channel2_ = ch2; |
| 147 rtc::PacketTransportInterface* rtp1 = nullptr; |
| 148 rtc::PacketTransportInterface* rtcp1 = nullptr; |
| 149 rtc::PacketTransportInterface* rtp2 = nullptr; |
| 150 rtc::PacketTransportInterface* rtcp2 = nullptr; |
| 151 // Based on flags, create fake DTLS or raw packet transports. |
| 152 if (flags1 & RAW_PACKET_TRANSPORT) { |
| 153 fake_rtp_packet_transport1_.reset( |
| 154 new rtc::FakePacketTransport("channel1_rtp")); |
| 155 rtp1 = fake_rtp_packet_transport1_.get(); |
| 156 if (!(flags1 & RTCP_MUX_REQUIRED)) { |
| 157 fake_rtcp_packet_transport1_.reset( |
| 158 new rtc::FakePacketTransport("channel1_rtcp")); |
| 159 rtcp1 = fake_rtcp_dtls_transport1_.get(); |
| 160 } |
| 161 } else { |
| 162 // Confirmed to work with KT_RSA and KT_ECDSA. |
| 163 fake_rtp_dtls_transport1_.reset(new cricket::FakeDtlsTransport( |
| 164 "channel1", cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
| 165 rtp1 = fake_rtp_dtls_transport1_.get(); |
| 166 if (!(flags1 & RTCP_MUX_REQUIRED)) { |
| 167 fake_rtcp_dtls_transport1_.reset(new cricket::FakeDtlsTransport( |
| 168 "channel1", cricket::ICE_CANDIDATE_COMPONENT_RTCP)); |
| 169 rtcp1 = fake_rtcp_dtls_transport1_.get(); |
| 170 } |
| 171 if (flags1 & DTLS) { |
| 172 auto cert1 = |
| 173 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( |
| 174 rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT))); |
| 175 fake_rtp_dtls_transport1_->SetLocalCertificate(cert1); |
| 176 if (fake_rtcp_dtls_transport1_) { |
| 177 fake_rtcp_dtls_transport1_->SetLocalCertificate(cert1); |
| 178 } |
| 179 } |
| 180 } |
| 181 // Based on flags, create fake DTLS or raw packet transports. |
| 182 if (flags2 & RAW_PACKET_TRANSPORT) { |
| 183 fake_rtp_packet_transport2_.reset( |
| 184 new rtc::FakePacketTransport("channel2_rtp")); |
| 185 rtp2 = fake_rtp_packet_transport2_.get(); |
| 186 if (!(flags2 & RTCP_MUX_REQUIRED)) { |
| 187 fake_rtcp_packet_transport2_.reset( |
| 188 new rtc::FakePacketTransport("channel2_rtcp")); |
| 189 rtcp2 = fake_rtcp_dtls_transport2_.get(); |
| 190 } |
| 191 } else { |
| 192 // Confirmed to work with KT_RSA and KT_ECDSA. |
| 193 fake_rtp_dtls_transport2_.reset(new cricket::FakeDtlsTransport( |
| 194 "channel2", cricket::ICE_CANDIDATE_COMPONENT_RTP)); |
| 195 rtp2 = fake_rtp_dtls_transport2_.get(); |
| 196 if (!(flags2 & RTCP_MUX_REQUIRED)) { |
| 197 fake_rtcp_dtls_transport2_.reset(new cricket::FakeDtlsTransport( |
| 198 "channel2", cricket::ICE_CANDIDATE_COMPONENT_RTCP)); |
| 199 rtcp2 = fake_rtcp_dtls_transport2_.get(); |
| 200 } |
| 201 if (flags2 & DTLS) { |
| 202 auto cert2 = |
| 203 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( |
| 204 rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT))); |
| 205 fake_rtp_dtls_transport2_->SetLocalCertificate(cert2); |
| 206 if (fake_rtcp_dtls_transport2_) { |
| 207 fake_rtcp_dtls_transport2_->SetLocalCertificate(cert2); |
| 208 } |
| 209 } |
| 210 } |
| 148 channel1_.reset( | 211 channel1_.reset( |
| 149 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, | 212 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, |
| 150 transport_controller1_.get(), flags1)); | 213 fake_rtp_dtls_transport1_.get(), |
| 214 fake_rtcp_dtls_transport1_.get(), rtp1, rtcp1, flags1)); |
| 151 channel2_.reset( | 215 channel2_.reset( |
| 152 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, | 216 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, |
| 153 transport_controller2_.get(), flags2)); | 217 fake_rtp_dtls_transport2_.get(), |
| 218 fake_rtcp_dtls_transport2_.get(), rtp2, rtcp2, flags2)); |
| 154 channel1_->SignalMediaMonitor.connect(this, | 219 channel1_->SignalMediaMonitor.connect(this, |
| 155 &ChannelTest<T>::OnMediaMonitor1); | 220 &ChannelTest<T>::OnMediaMonitor1); |
| 156 channel2_->SignalMediaMonitor.connect(this, | 221 channel2_->SignalMediaMonitor.connect(this, |
| 157 &ChannelTest<T>::OnMediaMonitor2); | 222 &ChannelTest<T>::OnMediaMonitor2); |
| 158 channel1_->SignalRtcpMuxFullyActive.connect( | 223 channel1_->SignalRtcpMuxFullyActive.connect( |
| 159 transport_controller1_.get(), | 224 this, &ChannelTest<T>::OnRtcpMuxFullyActive1); |
| 160 &cricket::FakeTransportController::DestroyRtcpTransport); | |
| 161 channel2_->SignalRtcpMuxFullyActive.connect( | 225 channel2_->SignalRtcpMuxFullyActive.connect( |
| 162 transport_controller2_.get(), | 226 this, &ChannelTest<T>::OnRtcpMuxFullyActive2); |
| 163 &cricket::FakeTransportController::DestroyRtcpTransport); | |
| 164 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 227 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
| 165 flags1 = (flags1 & ~SECURE); | 228 flags1 = (flags1 & ~SECURE); |
| 166 flags2 = (flags2 & ~SECURE); | 229 flags2 = (flags2 & ~SECURE); |
| 167 } | 230 } |
| 168 CreateContent(flags1, kPcmuCodec, kH264Codec, | 231 CreateContent(flags1, kPcmuCodec, kH264Codec, |
| 169 &local_media_content1_); | 232 &local_media_content1_); |
| 170 CreateContent(flags2, kPcmuCodec, kH264Codec, | 233 CreateContent(flags2, kPcmuCodec, kH264Codec, |
| 171 &local_media_content2_); | 234 &local_media_content2_); |
| 172 CopyContent(local_media_content1_, &remote_media_content1_); | 235 CopyContent(local_media_content1_, &remote_media_content1_); |
| 173 CopyContent(local_media_content2_, &remote_media_content2_); | 236 CopyContent(local_media_content2_, &remote_media_content2_); |
| 174 | 237 |
| 175 if (flags1 & DTLS) { | |
| 176 // Confirmed to work with KT_RSA and KT_ECDSA. | |
| 177 transport_controller1_->SetLocalCertificate( | |
| 178 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( | |
| 179 rtc::SSLIdentity::Generate("session1", rtc::KT_DEFAULT)))); | |
| 180 } | |
| 181 if (flags2 & DTLS) { | |
| 182 // Confirmed to work with KT_RSA and KT_ECDSA. | |
| 183 transport_controller2_->SetLocalCertificate( | |
| 184 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( | |
| 185 rtc::SSLIdentity::Generate("session2", rtc::KT_DEFAULT)))); | |
| 186 } | |
| 187 | |
| 188 // Add stream information (SSRC) to the local content but not to the remote | 238 // Add stream information (SSRC) to the local content but not to the remote |
| 189 // content. This means that we per default know the SSRC of what we send but | 239 // content. This means that we per default know the SSRC of what we send but |
| 190 // not what we receive. | 240 // not what we receive. |
| 191 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); | 241 AddLegacyStreamInContent(kSsrc1, flags1, &local_media_content1_); |
| 192 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); | 242 AddLegacyStreamInContent(kSsrc2, flags2, &local_media_content2_); |
| 193 | 243 |
| 194 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. | 244 // If SSRC_MUX is used we also need to know the SSRC of the incoming stream. |
| 195 if (flags1 & SSRC_MUX) { | 245 if (flags1 & SSRC_MUX) { |
| 196 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); | 246 AddLegacyStreamInContent(kSsrc1, flags1, &remote_media_content1_); |
| 197 } | 247 } |
| 198 if (flags2 & SSRC_MUX) { | 248 if (flags2 & SSRC_MUX) { |
| 199 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 249 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
| 200 } | 250 } |
| 201 } | 251 } |
| 202 typename T::Channel* CreateChannel( | 252 typename T::Channel* CreateChannel( |
| 203 rtc::Thread* worker_thread, | 253 rtc::Thread* worker_thread, |
| 204 rtc::Thread* network_thread, | 254 rtc::Thread* network_thread, |
| 205 cricket::MediaEngineInterface* engine, | 255 cricket::MediaEngineInterface* engine, |
| 206 typename T::MediaChannel* ch, | 256 typename T::MediaChannel* ch, |
| 207 cricket::TransportController* transport_controller, | 257 cricket::DtlsTransportInternal* fake_rtp_dtls_transport, |
| 258 cricket::DtlsTransportInternal* fake_rtcp_dtls_transport, |
| 259 rtc::PacketTransportInterface* fake_rtp_packet_transport, |
| 260 rtc::PacketTransportInterface* fake_rtcp_packet_transport, |
| 208 int flags) { | 261 int flags) { |
| 209 rtc::Thread* signaling_thread = | 262 rtc::Thread* signaling_thread = rtc::Thread::Current(); |
| 210 transport_controller ? transport_controller->signaling_thread() | |
| 211 : nullptr; | |
| 212 typename T::Channel* channel = new typename T::Channel( | 263 typename T::Channel* channel = new typename T::Channel( |
| 213 worker_thread, network_thread, signaling_thread, engine, ch, | 264 worker_thread, network_thread, signaling_thread, engine, ch, |
| 214 cricket::CN_AUDIO, (flags & RTCP_MUX_REQUIRED) != 0, | 265 cricket::CN_AUDIO, (flags & RTCP_MUX_REQUIRED) != 0, |
| 215 (flags & SECURE) != 0); | 266 (flags & SECURE) != 0); |
| 216 rtc::CryptoOptions crypto_options; | 267 rtc::CryptoOptions crypto_options; |
| 217 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 268 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 218 channel->SetCryptoOptions(crypto_options); | 269 channel->SetCryptoOptions(crypto_options); |
| 219 cricket::DtlsTransportInternal* rtp_dtls_transport = | 270 if (!channel->NeedsRtcpTransport()) { |
| 220 transport_controller->CreateDtlsTransport( | 271 fake_rtcp_dtls_transport = nullptr; |
| 221 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 222 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; | |
| 223 if (channel->NeedsRtcpTransport()) { | |
| 224 rtcp_dtls_transport = transport_controller->CreateDtlsTransport( | |
| 225 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 226 } | 272 } |
| 227 if (!channel->Init_w(rtp_dtls_transport, rtcp_dtls_transport)) { | 273 if (!channel->Init_w(fake_rtp_dtls_transport, fake_rtcp_dtls_transport, |
| 274 fake_rtp_packet_transport, |
| 275 fake_rtcp_packet_transport)) { |
| 228 delete channel; | 276 delete channel; |
| 229 channel = NULL; | 277 channel = NULL; |
| 230 } | 278 } |
| 231 return channel; | 279 return channel; |
| 232 } | 280 } |
| 233 | 281 |
| 282 void ConnectFakeTransports() { |
| 283 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 284 bool asymmetric = false; |
| 285 // Depending on test flags, could be using DTLS or raw packet transport. |
| 286 if (fake_rtp_dtls_transport1_ && fake_rtp_dtls_transport2_) { |
| 287 fake_rtp_dtls_transport1_->SetDestination( |
| 288 fake_rtp_dtls_transport2_.get(), asymmetric); |
| 289 } |
| 290 if (fake_rtcp_dtls_transport1_ && fake_rtcp_dtls_transport2_) { |
| 291 fake_rtcp_dtls_transport1_->SetDestination( |
| 292 fake_rtcp_dtls_transport2_.get(), asymmetric); |
| 293 } |
| 294 if (fake_rtp_packet_transport1_ && fake_rtp_packet_transport2_) { |
| 295 fake_rtp_packet_transport1_->SetDestination( |
| 296 fake_rtp_packet_transport2_.get(), asymmetric); |
| 297 } |
| 298 if (fake_rtcp_packet_transport1_ && fake_rtcp_packet_transport2_) { |
| 299 fake_rtcp_packet_transport1_->SetDestination( |
| 300 fake_rtcp_packet_transport2_.get(), asymmetric); |
| 301 } |
| 302 }); |
| 303 } |
| 304 |
| 234 bool SendInitiate() { | 305 bool SendInitiate() { |
| 235 bool result = channel1_->SetLocalContent(&local_media_content1_, | 306 bool result = channel1_->SetLocalContent(&local_media_content1_, |
| 236 CA_OFFER, NULL); | 307 CA_OFFER, NULL); |
| 237 if (result) { | 308 if (result) { |
| 238 channel1_->Enable(true); | 309 channel1_->Enable(true); |
| 239 result = channel2_->SetRemoteContent(&remote_media_content1_, | 310 result = channel2_->SetRemoteContent(&remote_media_content1_, |
| 240 CA_OFFER, NULL); | 311 CA_OFFER, NULL); |
| 241 if (result) { | 312 if (result) { |
| 242 transport_controller1_->Connect(transport_controller2_.get()); | 313 ConnectFakeTransports(); |
| 243 | |
| 244 result = channel2_->SetLocalContent(&local_media_content2_, | 314 result = channel2_->SetLocalContent(&local_media_content2_, |
| 245 CA_ANSWER, NULL); | 315 CA_ANSWER, NULL); |
| 246 } | 316 } |
| 247 } | 317 } |
| 248 return result; | 318 return result; |
| 249 } | 319 } |
| 250 | 320 |
| 251 bool SendAccept() { | 321 bool SendAccept() { |
| 252 channel2_->Enable(true); | 322 channel2_->Enable(true); |
| 253 return channel1_->SetRemoteContent(&remote_media_content2_, | 323 return channel1_->SetRemoteContent(&remote_media_content2_, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 265 return result; | 335 return result; |
| 266 } | 336 } |
| 267 | 337 |
| 268 bool SendProvisionalAnswer() { | 338 bool SendProvisionalAnswer() { |
| 269 bool result = channel2_->SetLocalContent(&local_media_content2_, | 339 bool result = channel2_->SetLocalContent(&local_media_content2_, |
| 270 CA_PRANSWER, NULL); | 340 CA_PRANSWER, NULL); |
| 271 if (result) { | 341 if (result) { |
| 272 channel2_->Enable(true); | 342 channel2_->Enable(true); |
| 273 result = channel1_->SetRemoteContent(&remote_media_content2_, | 343 result = channel1_->SetRemoteContent(&remote_media_content2_, |
| 274 CA_PRANSWER, NULL); | 344 CA_PRANSWER, NULL); |
| 275 transport_controller1_->Connect(transport_controller2_.get()); | 345 ConnectFakeTransports(); |
| 276 } | 346 } |
| 277 return result; | 347 return result; |
| 278 } | 348 } |
| 279 | 349 |
| 280 bool SendFinalAnswer() { | 350 bool SendFinalAnswer() { |
| 281 bool result = channel2_->SetLocalContent(&local_media_content2_, | 351 bool result = channel2_->SetLocalContent(&local_media_content2_, |
| 282 CA_ANSWER, NULL); | 352 CA_ANSWER, NULL); |
| 283 if (result) | 353 if (result) |
| 284 result = channel1_->SetRemoteContent(&remote_media_content2_, | 354 result = channel1_->SetRemoteContent(&remote_media_content2_, |
| 285 CA_ANSWER, NULL); | 355 CA_ANSWER, NULL); |
| 286 return result; | 356 return result; |
| 287 } | 357 } |
| 288 | 358 |
| 289 bool SendTerminate() { | 359 bool SendTerminate() { |
| 290 channel1_.reset(); | 360 channel1_.reset(); |
| 291 channel2_.reset(); | 361 channel2_.reset(); |
| 292 return true; | 362 return true; |
| 293 } | 363 } |
| 294 | 364 |
| 295 bool AddStream1(int id) { | 365 bool AddStream1(int id) { |
| 296 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 366 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
| 297 } | 367 } |
| 298 bool RemoveStream1(int id) { | 368 bool RemoveStream1(int id) { |
| 299 return channel1_->RemoveRecvStream(id); | 369 return channel1_->RemoveRecvStream(id); |
| 300 } | 370 } |
| 301 | 371 |
| 302 std::vector<cricket::DtlsTransportInternal*> GetChannels1() { | |
| 303 return transport_controller1_->channels_for_testing(); | |
| 304 } | |
| 305 | |
| 306 std::vector<cricket::DtlsTransportInternal*> GetChannels2() { | |
| 307 return transport_controller2_->channels_for_testing(); | |
| 308 } | |
| 309 | |
| 310 cricket::FakeDtlsTransport* GetFakeChannel1(int component) { | |
| 311 return transport_controller1_->GetFakeDtlsTransport_n( | |
| 312 channel1_->content_name(), component); | |
| 313 } | |
| 314 | |
| 315 cricket::FakeDtlsTransport* GetFakeChannel2(int component) { | |
| 316 return transport_controller2_->GetFakeDtlsTransport_n( | |
| 317 channel2_->content_name(), component); | |
| 318 } | |
| 319 | |
| 320 void SendRtp1() { | 372 void SendRtp1() { |
| 321 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 373 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
| 322 rtc::PacketOptions()); | 374 rtc::PacketOptions()); |
| 323 } | 375 } |
| 324 void SendRtp2() { | 376 void SendRtp2() { |
| 325 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 377 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
| 326 rtc::PacketOptions()); | 378 rtc::PacketOptions()); |
| 327 } | 379 } |
| 328 void SendRtcp1() { | 380 void SendRtcp1() { |
| 329 media_channel1_->SendRtcp(rtcp_packet_.data(), rtcp_packet_.size()); | 381 media_channel1_->SendRtcp(rtcp_packet_.data(), rtcp_packet_.size()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 bool CheckNoRtcp1() { | 456 bool CheckNoRtcp1() { |
| 405 return media_channel1_->CheckNoRtcp(); | 457 return media_channel1_->CheckNoRtcp(); |
| 406 } | 458 } |
| 407 bool CheckNoRtcp2() { | 459 bool CheckNoRtcp2() { |
| 408 return media_channel2_->CheckNoRtcp(); | 460 return media_channel2_->CheckNoRtcp(); |
| 409 } | 461 } |
| 410 // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. | 462 // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. |
| 411 // Returns true if so. | 463 // Returns true if so. |
| 412 bool CheckGcmCipher(typename T::Channel* channel, int flags) { | 464 bool CheckGcmCipher(typename T::Channel* channel, int flags) { |
| 413 int suite; | 465 int suite; |
| 414 if (!channel->rtp_dtls_transport()->GetSrtpCryptoSuite(&suite)) { | 466 cricket::FakeDtlsTransport* transport = |
| 467 (channel == channel1_.get()) ? fake_rtp_dtls_transport1_.get() |
| 468 : fake_rtp_dtls_transport2_.get(); |
| 469 RTC_DCHECK(transport); |
| 470 if (!transport->GetSrtpCryptoSuite(&suite)) { |
| 415 return false; | 471 return false; |
| 416 } | 472 } |
| 417 | 473 |
| 418 if (flags & GCM_CIPHER) { | 474 if (flags & GCM_CIPHER) { |
| 419 return rtc::IsGcmCryptoSuite(suite); | 475 return rtc::IsGcmCryptoSuite(suite); |
| 420 } else { | 476 } else { |
| 421 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && | 477 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && |
| 422 !rtc::IsGcmCryptoSuite(suite)); | 478 !rtc::IsGcmCryptoSuite(suite)); |
| 423 } | 479 } |
| 424 } | 480 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void OnMediaMonitor1(typename T::Channel* channel, | 531 void OnMediaMonitor1(typename T::Channel* channel, |
| 476 const typename T::MediaInfo& info) { | 532 const typename T::MediaInfo& info) { |
| 477 RTC_DCHECK_EQ(channel, channel1_.get()); | 533 RTC_DCHECK_EQ(channel, channel1_.get()); |
| 478 media_info_callbacks1_++; | 534 media_info_callbacks1_++; |
| 479 } | 535 } |
| 480 void OnMediaMonitor2(typename T::Channel* channel, | 536 void OnMediaMonitor2(typename T::Channel* channel, |
| 481 const typename T::MediaInfo& info) { | 537 const typename T::MediaInfo& info) { |
| 482 RTC_DCHECK_EQ(channel, channel2_.get()); | 538 RTC_DCHECK_EQ(channel, channel2_.get()); |
| 483 media_info_callbacks2_++; | 539 media_info_callbacks2_++; |
| 484 } | 540 } |
| 541 void OnRtcpMuxFullyActive1(const std::string&) { |
| 542 rtcp_mux_activated_callbacks1_++; |
| 543 } |
| 544 void OnRtcpMuxFullyActive2(const std::string&) { |
| 545 rtcp_mux_activated_callbacks2_++; |
| 546 } |
| 485 | 547 |
| 486 cricket::CandidatePairInterface* last_selected_candidate_pair() { | 548 cricket::CandidatePairInterface* last_selected_candidate_pair() { |
| 487 return last_selected_candidate_pair_; | 549 return last_selected_candidate_pair_; |
| 488 } | 550 } |
| 489 | 551 |
| 490 void AddLegacyStreamInContent(uint32_t ssrc, | 552 void AddLegacyStreamInContent(uint32_t ssrc, |
| 491 int flags, | 553 int flags, |
| 492 typename T::Content* content) { | 554 typename T::Content* content) { |
| 493 // Base implementation. | 555 // Base implementation. |
| 494 } | 556 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 596 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 535 ASSERT_EQ(1U, media_channel1_->codecs().size()); | 597 ASSERT_EQ(1U, media_channel1_->codecs().size()); |
| 536 EXPECT_TRUE(CodecMatches(content.codecs()[0], | 598 EXPECT_TRUE(CodecMatches(content.codecs()[0], |
| 537 media_channel1_->codecs()[0])); | 599 media_channel1_->codecs()[0])); |
| 538 } | 600 } |
| 539 | 601 |
| 540 // Test that SetLocalContent and SetRemoteContent properly set RTCP | 602 // Test that SetLocalContent and SetRemoteContent properly set RTCP |
| 541 // mux. | 603 // mux. |
| 542 void TestSetContentsRtcpMux() { | 604 void TestSetContentsRtcpMux() { |
| 543 CreateChannels(0, 0); | 605 CreateChannels(0, 0); |
| 544 EXPECT_TRUE(channel1_->rtcp_dtls_transport() != NULL); | |
| 545 EXPECT_TRUE(channel2_->rtcp_dtls_transport() != NULL); | |
| 546 typename T::Content content; | 606 typename T::Content content; |
| 547 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 607 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
| 548 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 608 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
| 549 content.set_rtcp_mux(true); | 609 content.set_rtcp_mux(true); |
| 550 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 610 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 551 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 611 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 552 EXPECT_TRUE(channel1_->rtcp_dtls_transport() == NULL); | |
| 553 // Only initiator supports mux. Should still have a separate RTCP channel. | 612 // Only initiator supports mux. Should still have a separate RTCP channel. |
| 554 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); | 613 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 555 content.set_rtcp_mux(false); | 614 content.set_rtcp_mux(false); |
| 556 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 615 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 557 EXPECT_TRUE(channel2_->rtcp_dtls_transport() != NULL); | |
| 558 } | 616 } |
| 559 | 617 |
| 560 // Test that SetLocalContent and SetRemoteContent properly set RTCP | 618 // Test that SetLocalContent and SetRemoteContent properly set RTCP |
| 561 // mux when a provisional answer is received. | 619 // mux when a provisional answer is received. |
| 562 void TestSetContentsRtcpMuxWithPrAnswer() { | 620 void TestSetContentsRtcpMuxWithPrAnswer() { |
| 563 CreateChannels(0, 0); | 621 CreateChannels(0, 0); |
| 564 EXPECT_TRUE(channel1_->rtcp_dtls_transport() != NULL); | |
| 565 EXPECT_TRUE(channel2_->rtcp_dtls_transport() != NULL); | |
| 566 typename T::Content content; | 622 typename T::Content content; |
| 567 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 623 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
| 568 content.set_rtcp_mux(true); | 624 content.set_rtcp_mux(true); |
| 569 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 625 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 570 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL)); | 626 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL)); |
| 571 EXPECT_TRUE(channel1_->rtcp_dtls_transport() != NULL); | 627 // Both sides agree on mux. Should signal RTCP mux as fully activated. |
| 628 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 572 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 629 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 573 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 630 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 574 EXPECT_TRUE(channel1_->rtcp_dtls_transport() == NULL); | |
| 575 // Only initiator supports mux. Should still have a separate RTCP channel. | 631 // Only initiator supports mux. Should still have a separate RTCP channel. |
| 576 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); | 632 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 577 content.set_rtcp_mux(false); | 633 content.set_rtcp_mux(false); |
| 578 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); | 634 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); |
| 579 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 635 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 580 EXPECT_TRUE(channel2_->rtcp_dtls_transport() != NULL); | 636 EXPECT_EQ(0, rtcp_mux_activated_callbacks2_); |
| 581 } | 637 } |
| 582 | 638 |
| 583 // Test that SetRemoteContent properly deals with a content update. | 639 // Test that SetRemoteContent properly deals with a content update. |
| 584 void TestSetRemoteContentUpdate() { | 640 void TestSetRemoteContentUpdate() { |
| 585 CreateChannels(0, 0); | 641 CreateChannels(0, 0); |
| 586 typename T::Content content; | 642 typename T::Content content; |
| 587 CreateContent(RTCP_MUX | SECURE, kPcmuCodec, kH264Codec, &content); | 643 CreateContent(RTCP_MUX | SECURE, kPcmuCodec, kH264Codec, &content); |
| 588 EXPECT_EQ(0U, media_channel1_->codecs().size()); | 644 EXPECT_EQ(0U, media_channel1_->codecs().size()); |
| 589 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 645 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 590 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 646 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 CreateChannels(0, 0); | 832 CreateChannels(0, 0); |
| 777 typename T::Content content1; | 833 typename T::Content content1; |
| 778 CreateContent(0, kPcmuCodec, kH264Codec, &content1); | 834 CreateContent(0, kPcmuCodec, kH264Codec, &content1); |
| 779 content1.AddStream(stream1); | 835 content1.AddStream(stream1); |
| 780 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 836 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
| 781 EXPECT_TRUE(channel1_->Enable(true)); | 837 EXPECT_TRUE(channel1_->Enable(true)); |
| 782 EXPECT_EQ(1u, media_channel1_->send_streams().size()); | 838 EXPECT_EQ(1u, media_channel1_->send_streams().size()); |
| 783 | 839 |
| 784 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 840 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
| 785 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); | 841 EXPECT_EQ(1u, media_channel2_->recv_streams().size()); |
| 786 transport_controller1_->Connect(transport_controller2_.get()); | 842 ConnectFakeTransports(); |
| 787 | 843 |
| 788 // Channel 2 do not send anything. | 844 // Channel 2 do not send anything. |
| 789 typename T::Content content2; | 845 typename T::Content content2; |
| 790 CreateContent(0, kPcmuCodec, kH264Codec, &content2); | 846 CreateContent(0, kPcmuCodec, kH264Codec, &content2); |
| 791 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); | 847 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_ANSWER, NULL)); |
| 792 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); | 848 EXPECT_EQ(0u, media_channel1_->recv_streams().size()); |
| 793 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); | 849 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_ANSWER, NULL)); |
| 794 EXPECT_TRUE(channel2_->Enable(true)); | 850 EXPECT_TRUE(channel2_->Enable(true)); |
| 795 EXPECT_EQ(0u, media_channel2_->send_streams().size()); | 851 EXPECT_EQ(0u, media_channel2_->send_streams().size()); |
| 796 | 852 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 if (verify_playout_) { | 909 if (verify_playout_) { |
| 854 EXPECT_FALSE(media_channel2_->playout()); | 910 EXPECT_FALSE(media_channel2_->playout()); |
| 855 } | 911 } |
| 856 EXPECT_FALSE(media_channel2_->sending()); | 912 EXPECT_FALSE(media_channel2_->sending()); |
| 857 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, | 913 EXPECT_TRUE(channel2_->SetLocalContent(&local_media_content2_, |
| 858 CA_ANSWER, NULL)); | 914 CA_ANSWER, NULL)); |
| 859 if (verify_playout_) { | 915 if (verify_playout_) { |
| 860 EXPECT_FALSE(media_channel2_->playout()); | 916 EXPECT_FALSE(media_channel2_->playout()); |
| 861 } | 917 } |
| 862 EXPECT_FALSE(media_channel2_->sending()); | 918 EXPECT_FALSE(media_channel2_->sending()); |
| 863 transport_controller1_->Connect(transport_controller2_.get()); | 919 ConnectFakeTransports(); |
| 864 if (verify_playout_) { | 920 if (verify_playout_) { |
| 865 EXPECT_TRUE(media_channel1_->playout()); | 921 EXPECT_TRUE(media_channel1_->playout()); |
| 866 } | 922 } |
| 867 EXPECT_FALSE(media_channel1_->sending()); | 923 EXPECT_FALSE(media_channel1_->sending()); |
| 868 if (verify_playout_) { | 924 if (verify_playout_) { |
| 869 EXPECT_FALSE(media_channel2_->playout()); | 925 EXPECT_FALSE(media_channel2_->playout()); |
| 870 } | 926 } |
| 871 EXPECT_FALSE(media_channel2_->sending()); | 927 EXPECT_FALSE(media_channel2_->sending()); |
| 872 EXPECT_TRUE(channel2_->Enable(true)); | 928 EXPECT_TRUE(channel2_->Enable(true)); |
| 873 if (verify_playout_) { | 929 if (verify_playout_) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 901 EXPECT_FALSE(media_channel1_->sending()); | 957 EXPECT_FALSE(media_channel1_->sending()); |
| 902 if (verify_playout_) { | 958 if (verify_playout_) { |
| 903 EXPECT_FALSE(media_channel2_->playout()); | 959 EXPECT_FALSE(media_channel2_->playout()); |
| 904 } | 960 } |
| 905 EXPECT_FALSE(media_channel2_->sending()); | 961 EXPECT_FALSE(media_channel2_->sending()); |
| 906 | 962 |
| 907 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); | 963 EXPECT_TRUE(channel1_->SetLocalContent(&content1, CA_OFFER, NULL)); |
| 908 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); | 964 EXPECT_TRUE(channel2_->SetRemoteContent(&content1, CA_OFFER, NULL)); |
| 909 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); | 965 EXPECT_TRUE(channel2_->SetLocalContent(&content2, CA_PRANSWER, NULL)); |
| 910 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); | 966 EXPECT_TRUE(channel1_->SetRemoteContent(&content2, CA_PRANSWER, NULL)); |
| 911 transport_controller1_->Connect(transport_controller2_.get()); | 967 ConnectFakeTransports(); |
| 912 | 968 |
| 913 if (verify_playout_) { | 969 if (verify_playout_) { |
| 914 EXPECT_TRUE(media_channel1_->playout()); | 970 EXPECT_TRUE(media_channel1_->playout()); |
| 915 } | 971 } |
| 916 EXPECT_FALSE(media_channel1_->sending()); // remote InActive | 972 EXPECT_FALSE(media_channel1_->sending()); // remote InActive |
| 917 if (verify_playout_) { | 973 if (verify_playout_) { |
| 918 EXPECT_FALSE(media_channel2_->playout()); // local InActive | 974 EXPECT_FALSE(media_channel2_->playout()); // local InActive |
| 919 } | 975 } |
| 920 EXPECT_FALSE(media_channel2_->sending()); // local InActive | 976 EXPECT_FALSE(media_channel2_->sending()); // local InActive |
| 921 | 977 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 950 | 1006 |
| 951 // Tests that when the transport channel signals a candidate pair change | 1007 // Tests that when the transport channel signals a candidate pair change |
| 952 // event, the media channel will receive a call on the network route change. | 1008 // event, the media channel will receive a call on the network route change. |
| 953 void TestNetworkRouteChanges() { | 1009 void TestNetworkRouteChanges() { |
| 954 constexpr uint16_t kLocalNetId = 1; | 1010 constexpr uint16_t kLocalNetId = 1; |
| 955 constexpr uint16_t kRemoteNetId = 2; | 1011 constexpr uint16_t kRemoteNetId = 2; |
| 956 constexpr int kLastPacketId = 100; | 1012 constexpr int kLastPacketId = 100; |
| 957 | 1013 |
| 958 CreateChannels(0, 0); | 1014 CreateChannels(0, 0); |
| 959 | 1015 |
| 960 cricket::DtlsTransportInternal* transport_channel1 = | |
| 961 channel1_->rtp_dtls_transport(); | |
| 962 ASSERT_TRUE(transport_channel1); | |
| 963 typename T::MediaChannel* media_channel1 = | 1016 typename T::MediaChannel* media_channel1 = |
| 964 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); | 1017 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); |
| 965 ASSERT_TRUE(media_channel1); | 1018 ASSERT_TRUE(media_channel1); |
| 966 | 1019 |
| 967 media_channel1->set_num_network_route_changes(0); | 1020 media_channel1->set_num_network_route_changes(0); |
| 968 network_thread_->Invoke<void>(RTC_FROM_HERE, [transport_channel1] { | 1021 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 969 // The transport channel becomes disconnected. | 1022 // The transport channel becomes disconnected. |
| 970 transport_channel1->ice_transport()->SignalSelectedCandidatePairChanged( | 1023 fake_rtp_dtls_transport1_->ice_transport() |
| 971 transport_channel1->ice_transport(), nullptr, -1, false); | 1024 ->SignalSelectedCandidatePairChanged( |
| 1025 fake_rtp_dtls_transport1_->ice_transport(), nullptr, -1, false); |
| 972 }); | 1026 }); |
| 973 WaitForThreads(); | 1027 WaitForThreads(); |
| 974 EXPECT_EQ(1, media_channel1->num_network_route_changes()); | 1028 EXPECT_EQ(1, media_channel1->num_network_route_changes()); |
| 975 EXPECT_FALSE(media_channel1->last_network_route().connected); | 1029 EXPECT_FALSE(media_channel1->last_network_route().connected); |
| 976 media_channel1->set_num_network_route_changes(0); | 1030 media_channel1->set_num_network_route_changes(0); |
| 977 | 1031 |
| 978 network_thread_->Invoke<void>(RTC_FROM_HERE, [this, transport_channel1, | 1032 network_thread_->Invoke<void>(RTC_FROM_HERE, [this, media_channel1, |
| 979 media_channel1, kLocalNetId, | 1033 kLocalNetId, kRemoteNetId, |
| 980 kRemoteNetId, kLastPacketId] { | 1034 kLastPacketId] { |
| 981 // The transport channel becomes connected. | 1035 // The transport channel becomes connected. |
| 982 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); | 1036 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); |
| 983 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); | 1037 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); |
| 984 std::unique_ptr<cricket::CandidatePairInterface> candidate_pair( | 1038 auto candidate_pair = cricket::FakeCandidatePair::Create( |
| 985 transport_controller1_->CreateFakeCandidatePair( | 1039 local_address, kLocalNetId, remote_address, kRemoteNetId); |
| 986 local_address, kLocalNetId, remote_address, kRemoteNetId)); | 1040 fake_rtp_dtls_transport1_->ice_transport() |
| 987 transport_channel1->ice_transport()->SignalSelectedCandidatePairChanged( | 1041 ->SignalSelectedCandidatePairChanged( |
| 988 transport_channel1->ice_transport(), candidate_pair.get(), | 1042 fake_rtp_dtls_transport1_->ice_transport(), candidate_pair.get(), |
| 989 kLastPacketId, true); | 1043 kLastPacketId, true); |
| 990 }); | 1044 }); |
| 991 WaitForThreads(); | 1045 WaitForThreads(); |
| 992 EXPECT_EQ(1, media_channel1->num_network_route_changes()); | 1046 EXPECT_EQ(1, media_channel1->num_network_route_changes()); |
| 993 rtc::NetworkRoute expected_network_route(true, kLocalNetId, kRemoteNetId, | 1047 rtc::NetworkRoute expected_network_route(true, kLocalNetId, kRemoteNetId, |
| 994 kLastPacketId); | 1048 kLastPacketId); |
| 995 EXPECT_EQ(expected_network_route, media_channel1->last_network_route()); | 1049 EXPECT_EQ(expected_network_route, media_channel1->last_network_route()); |
| 996 EXPECT_EQ(kLastPacketId, | 1050 EXPECT_EQ(kLastPacketId, |
| 997 media_channel1->last_network_route().last_sent_packet_id); | 1051 media_channel1->last_network_route().last_sent_packet_id); |
| 998 constexpr int kTransportOverheadPerPacket = 28; // Ipv4(20) + UDP(8). | 1052 constexpr int kTransportOverheadPerPacket = 28; // Ipv4(20) + UDP(8). |
| 999 EXPECT_EQ(kTransportOverheadPerPacket, | 1053 EXPECT_EQ(kTransportOverheadPerPacket, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 EXPECT_TRUE(SendInitiate()); | 1093 EXPECT_TRUE(SendInitiate()); |
| 1040 EXPECT_TRUE(SendAccept()); | 1094 EXPECT_TRUE(SendAccept()); |
| 1041 EXPECT_TRUE(SendTerminate()); | 1095 EXPECT_TRUE(SendTerminate()); |
| 1042 } | 1096 } |
| 1043 | 1097 |
| 1044 // Send voice RTP data to the other side and ensure it gets there. | 1098 // Send voice RTP data to the other side and ensure it gets there. |
| 1045 void SendRtpToRtp() { | 1099 void SendRtpToRtp() { |
| 1046 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); | 1100 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); |
| 1047 EXPECT_TRUE(SendInitiate()); | 1101 EXPECT_TRUE(SendInitiate()); |
| 1048 EXPECT_TRUE(SendAccept()); | 1102 EXPECT_TRUE(SendAccept()); |
| 1049 EXPECT_EQ(1U, GetChannels1().size()); | 1103 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1050 EXPECT_EQ(1U, GetChannels2().size()); | 1104 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1051 SendRtp1(); | 1105 SendRtp1(); |
| 1052 SendRtp2(); | 1106 SendRtp2(); |
| 1053 WaitForThreads(); | 1107 WaitForThreads(); |
| 1054 EXPECT_TRUE(CheckRtp1()); | 1108 EXPECT_TRUE(CheckRtp1()); |
| 1055 EXPECT_TRUE(CheckRtp2()); | 1109 EXPECT_TRUE(CheckRtp2()); |
| 1056 EXPECT_TRUE(CheckNoRtp1()); | 1110 EXPECT_TRUE(CheckNoRtp1()); |
| 1057 EXPECT_TRUE(CheckNoRtp2()); | 1111 EXPECT_TRUE(CheckNoRtp2()); |
| 1058 } | 1112 } |
| 1059 | 1113 |
| 1060 void TestDeinit() { | 1114 void TestDeinit() { |
| 1061 CreateChannels(0, 0); | 1115 CreateChannels(0, 0); |
| 1062 EXPECT_TRUE(SendInitiate()); | 1116 EXPECT_TRUE(SendInitiate()); |
| 1063 EXPECT_TRUE(SendAccept()); | 1117 EXPECT_TRUE(SendAccept()); |
| 1064 SendRtp1(); | 1118 SendRtp1(); |
| 1065 SendRtp2(); | 1119 SendRtp2(); |
| 1066 SendRtcp1(); | 1120 SendRtcp1(); |
| 1067 SendRtcp2(); | 1121 SendRtcp2(); |
| 1068 // Do not wait, destroy channels. | 1122 // Do not wait, destroy channels. |
| 1069 channel1_.reset(nullptr); | 1123 channel1_.reset(nullptr); |
| 1070 channel2_.reset(nullptr); | 1124 channel2_.reset(nullptr); |
| 1071 } | 1125 } |
| 1072 | 1126 |
| 1073 // Check that RTCP can be transmitted between both sides. | 1127 // Check that RTCP can be transmitted between both sides. |
| 1074 void SendRtcpToRtcp() { | 1128 void SendRtcpToRtcp() { |
| 1075 CreateChannels(0, 0); | 1129 CreateChannels(0, 0); |
| 1076 EXPECT_TRUE(SendInitiate()); | 1130 EXPECT_TRUE(SendInitiate()); |
| 1077 EXPECT_TRUE(SendAccept()); | 1131 EXPECT_TRUE(SendAccept()); |
| 1078 EXPECT_EQ(2U, GetChannels1().size()); | 1132 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1079 EXPECT_EQ(2U, GetChannels2().size()); | 1133 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1080 SendRtcp1(); | 1134 SendRtcp1(); |
| 1081 SendRtcp2(); | 1135 SendRtcp2(); |
| 1082 WaitForThreads(); | 1136 WaitForThreads(); |
| 1083 EXPECT_TRUE(CheckRtcp1()); | 1137 EXPECT_TRUE(CheckRtcp1()); |
| 1084 EXPECT_TRUE(CheckRtcp2()); | 1138 EXPECT_TRUE(CheckRtcp2()); |
| 1085 EXPECT_TRUE(CheckNoRtcp1()); | 1139 EXPECT_TRUE(CheckNoRtcp1()); |
| 1086 EXPECT_TRUE(CheckNoRtcp2()); | 1140 EXPECT_TRUE(CheckNoRtcp2()); |
| 1087 } | 1141 } |
| 1088 | 1142 |
| 1089 // Check that RTCP is transmitted if only the initiator supports mux. | 1143 // Check that RTCP is transmitted if only the initiator supports mux. |
| 1090 void SendRtcpMuxToRtcp() { | 1144 void SendRtcpMuxToRtcp() { |
| 1091 CreateChannels(RTCP_MUX, 0); | 1145 CreateChannels(RTCP_MUX, 0); |
| 1092 EXPECT_TRUE(SendInitiate()); | 1146 EXPECT_TRUE(SendInitiate()); |
| 1093 EXPECT_TRUE(SendAccept()); | 1147 EXPECT_TRUE(SendAccept()); |
| 1094 EXPECT_EQ(2U, GetChannels1().size()); | 1148 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1095 EXPECT_EQ(2U, GetChannels2().size()); | 1149 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1096 SendRtcp1(); | 1150 SendRtcp1(); |
| 1097 SendRtcp2(); | 1151 SendRtcp2(); |
| 1098 WaitForThreads(); | 1152 WaitForThreads(); |
| 1099 EXPECT_TRUE(CheckRtcp1()); | 1153 EXPECT_TRUE(CheckRtcp1()); |
| 1100 EXPECT_TRUE(CheckRtcp2()); | 1154 EXPECT_TRUE(CheckRtcp2()); |
| 1101 EXPECT_TRUE(CheckNoRtcp1()); | 1155 EXPECT_TRUE(CheckNoRtcp1()); |
| 1102 EXPECT_TRUE(CheckNoRtcp2()); | 1156 EXPECT_TRUE(CheckNoRtcp2()); |
| 1103 } | 1157 } |
| 1104 | 1158 |
| 1105 // Check that RTP and RTCP are transmitted ok when both sides support mux. | 1159 // Check that RTP and RTCP are transmitted ok when both sides support mux. |
| 1106 void SendRtcpMuxToRtcpMux() { | 1160 void SendRtcpMuxToRtcpMux() { |
| 1107 CreateChannels(RTCP_MUX, RTCP_MUX); | 1161 CreateChannels(RTCP_MUX, RTCP_MUX); |
| 1108 EXPECT_TRUE(SendInitiate()); | 1162 EXPECT_TRUE(SendInitiate()); |
| 1109 EXPECT_EQ(2U, GetChannels1().size()); | 1163 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1110 EXPECT_EQ(1U, GetChannels2().size()); | 1164 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1165 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 1111 EXPECT_TRUE(SendAccept()); | 1166 EXPECT_TRUE(SendAccept()); |
| 1112 EXPECT_EQ(1U, GetChannels1().size()); | 1167 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1168 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 1113 SendRtp1(); | 1169 SendRtp1(); |
| 1114 SendRtp2(); | 1170 SendRtp2(); |
| 1115 SendRtcp1(); | 1171 SendRtcp1(); |
| 1116 SendRtcp2(); | 1172 SendRtcp2(); |
| 1117 WaitForThreads(); | 1173 WaitForThreads(); |
| 1118 EXPECT_TRUE(CheckRtp1()); | 1174 EXPECT_TRUE(CheckRtp1()); |
| 1119 EXPECT_TRUE(CheckRtp2()); | 1175 EXPECT_TRUE(CheckRtp2()); |
| 1120 EXPECT_TRUE(CheckNoRtp1()); | 1176 EXPECT_TRUE(CheckNoRtp1()); |
| 1121 EXPECT_TRUE(CheckNoRtp2()); | 1177 EXPECT_TRUE(CheckNoRtp2()); |
| 1122 EXPECT_TRUE(CheckRtcp1()); | 1178 EXPECT_TRUE(CheckRtcp1()); |
| 1123 EXPECT_TRUE(CheckRtcp2()); | 1179 EXPECT_TRUE(CheckRtcp2()); |
| 1124 EXPECT_TRUE(CheckNoRtcp1()); | 1180 EXPECT_TRUE(CheckNoRtcp1()); |
| 1125 EXPECT_TRUE(CheckNoRtcp2()); | 1181 EXPECT_TRUE(CheckNoRtcp2()); |
| 1126 } | 1182 } |
| 1127 | 1183 |
| 1128 // Check that RTP and RTCP are transmitted ok when both sides | 1184 // Check that RTP and RTCP are transmitted ok when both sides |
| 1129 // support mux and one the offerer requires mux. | 1185 // support mux and one the offerer requires mux. |
| 1130 void SendRequireRtcpMuxToRtcpMux() { | 1186 void SendRequireRtcpMuxToRtcpMux() { |
| 1131 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX); | 1187 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX); |
| 1132 EXPECT_TRUE(SendInitiate()); | 1188 EXPECT_TRUE(SendInitiate()); |
| 1133 EXPECT_EQ(1U, GetChannels1().size()); | 1189 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1134 EXPECT_EQ(1U, GetChannels2().size()); | 1190 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1135 EXPECT_TRUE(SendAccept()); | 1191 EXPECT_TRUE(SendAccept()); |
| 1136 SendRtp1(); | 1192 SendRtp1(); |
| 1137 SendRtp2(); | 1193 SendRtp2(); |
| 1138 SendRtcp1(); | 1194 SendRtcp1(); |
| 1139 SendRtcp2(); | 1195 SendRtcp2(); |
| 1140 WaitForThreads(); | 1196 WaitForThreads(); |
| 1141 EXPECT_TRUE(CheckRtp1()); | 1197 EXPECT_TRUE(CheckRtp1()); |
| 1142 EXPECT_TRUE(CheckRtp2()); | 1198 EXPECT_TRUE(CheckRtp2()); |
| 1143 EXPECT_TRUE(CheckNoRtp1()); | 1199 EXPECT_TRUE(CheckNoRtp1()); |
| 1144 EXPECT_TRUE(CheckNoRtp2()); | 1200 EXPECT_TRUE(CheckNoRtp2()); |
| 1145 EXPECT_TRUE(CheckRtcp1()); | 1201 EXPECT_TRUE(CheckRtcp1()); |
| 1146 EXPECT_TRUE(CheckRtcp2()); | 1202 EXPECT_TRUE(CheckRtcp2()); |
| 1147 EXPECT_TRUE(CheckNoRtcp1()); | 1203 EXPECT_TRUE(CheckNoRtcp1()); |
| 1148 EXPECT_TRUE(CheckNoRtcp2()); | 1204 EXPECT_TRUE(CheckNoRtcp2()); |
| 1149 } | 1205 } |
| 1150 | 1206 |
| 1151 // Check that RTP and RTCP are transmitted ok when both sides | 1207 // Check that RTP and RTCP are transmitted ok when both sides |
| 1152 // support mux and only the answerer requires rtcp mux. | 1208 // support mux and only the answerer requires rtcp mux. |
| 1153 void SendRtcpMuxToRequireRtcpMux() { | 1209 void SendRtcpMuxToRequireRtcpMux() { |
| 1154 CreateChannels(RTCP_MUX, RTCP_MUX | RTCP_MUX_REQUIRED); | 1210 CreateChannels(RTCP_MUX, RTCP_MUX | RTCP_MUX_REQUIRED); |
| 1155 EXPECT_TRUE(SendInitiate()); | 1211 EXPECT_TRUE(SendInitiate()); |
| 1156 EXPECT_EQ(2U, GetChannels1().size()); | 1212 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1157 EXPECT_EQ(1U, GetChannels2().size()); | 1213 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1214 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 1158 EXPECT_TRUE(SendAccept()); | 1215 EXPECT_TRUE(SendAccept()); |
| 1159 EXPECT_EQ(1U, GetChannels1().size()); | 1216 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1217 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 1160 SendRtp1(); | 1218 SendRtp1(); |
| 1161 SendRtp2(); | 1219 SendRtp2(); |
| 1162 SendRtcp1(); | 1220 SendRtcp1(); |
| 1163 SendRtcp2(); | 1221 SendRtcp2(); |
| 1164 WaitForThreads(); | 1222 WaitForThreads(); |
| 1165 EXPECT_TRUE(CheckRtp1()); | 1223 EXPECT_TRUE(CheckRtp1()); |
| 1166 EXPECT_TRUE(CheckRtp2()); | 1224 EXPECT_TRUE(CheckRtp2()); |
| 1167 EXPECT_TRUE(CheckNoRtp1()); | 1225 EXPECT_TRUE(CheckNoRtp1()); |
| 1168 EXPECT_TRUE(CheckNoRtp2()); | 1226 EXPECT_TRUE(CheckNoRtp2()); |
| 1169 EXPECT_TRUE(CheckRtcp1()); | 1227 EXPECT_TRUE(CheckRtcp1()); |
| 1170 EXPECT_TRUE(CheckRtcp2()); | 1228 EXPECT_TRUE(CheckRtcp2()); |
| 1171 EXPECT_TRUE(CheckNoRtcp1()); | 1229 EXPECT_TRUE(CheckNoRtcp1()); |
| 1172 EXPECT_TRUE(CheckNoRtcp2()); | 1230 EXPECT_TRUE(CheckNoRtcp2()); |
| 1173 } | 1231 } |
| 1174 | 1232 |
| 1175 // Check that RTP and RTCP are transmitted ok when both sides | 1233 // Check that RTP and RTCP are transmitted ok when both sides |
| 1176 // require mux. | 1234 // require mux. |
| 1177 void SendRequireRtcpMuxToRequireRtcpMux() { | 1235 void SendRequireRtcpMuxToRequireRtcpMux() { |
| 1178 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); | 1236 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); |
| 1179 EXPECT_TRUE(SendInitiate()); | 1237 EXPECT_TRUE(SendInitiate()); |
| 1180 EXPECT_EQ(1U, GetChannels1().size()); | 1238 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1181 EXPECT_EQ(1U, GetChannels2().size()); | 1239 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1182 EXPECT_TRUE(SendAccept()); | 1240 EXPECT_TRUE(SendAccept()); |
| 1183 EXPECT_EQ(1U, GetChannels1().size()); | 1241 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1184 SendRtp1(); | 1242 SendRtp1(); |
| 1185 SendRtp2(); | 1243 SendRtp2(); |
| 1186 SendRtcp1(); | 1244 SendRtcp1(); |
| 1187 SendRtcp2(); | 1245 SendRtcp2(); |
| 1188 WaitForThreads(); | 1246 WaitForThreads(); |
| 1189 EXPECT_TRUE(CheckRtp1()); | 1247 EXPECT_TRUE(CheckRtp1()); |
| 1190 EXPECT_TRUE(CheckRtp2()); | 1248 EXPECT_TRUE(CheckRtp2()); |
| 1191 EXPECT_TRUE(CheckNoRtp1()); | 1249 EXPECT_TRUE(CheckNoRtp1()); |
| 1192 EXPECT_TRUE(CheckNoRtp2()); | 1250 EXPECT_TRUE(CheckNoRtp2()); |
| 1193 EXPECT_TRUE(CheckRtcp1()); | 1251 EXPECT_TRUE(CheckRtcp1()); |
| 1194 EXPECT_TRUE(CheckRtcp2()); | 1252 EXPECT_TRUE(CheckRtcp2()); |
| 1195 EXPECT_TRUE(CheckNoRtcp1()); | 1253 EXPECT_TRUE(CheckNoRtcp1()); |
| 1196 EXPECT_TRUE(CheckNoRtcp2()); | 1254 EXPECT_TRUE(CheckNoRtcp2()); |
| 1197 } | 1255 } |
| 1198 | 1256 |
| 1199 // Check that SendAccept fails if the answerer doesn't support mux | 1257 // Check that SendAccept fails if the answerer doesn't support mux |
| 1200 // and the offerer requires it. | 1258 // and the offerer requires it. |
| 1201 void SendRequireRtcpMuxToNoRtcpMux() { | 1259 void SendRequireRtcpMuxToNoRtcpMux() { |
| 1202 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, 0); | 1260 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, 0); |
| 1203 EXPECT_TRUE(SendInitiate()); | 1261 EXPECT_TRUE(SendInitiate()); |
| 1204 EXPECT_EQ(1U, GetChannels1().size()); | 1262 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1205 EXPECT_EQ(2U, GetChannels2().size()); | 1263 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1206 EXPECT_FALSE(SendAccept()); | 1264 EXPECT_FALSE(SendAccept()); |
| 1207 } | 1265 } |
| 1208 | 1266 |
| 1209 // Check that RTCP data sent by the initiator before the accept is not muxed. | 1267 // Check that RTCP data sent by the initiator before the accept is not muxed. |
| 1210 void SendEarlyRtcpMuxToRtcp() { | 1268 void SendEarlyRtcpMuxToRtcp() { |
| 1211 CreateChannels(RTCP_MUX, 0); | 1269 CreateChannels(RTCP_MUX, 0); |
| 1212 EXPECT_TRUE(SendInitiate()); | 1270 EXPECT_TRUE(SendInitiate()); |
| 1213 EXPECT_EQ(2U, GetChannels1().size()); | 1271 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1214 EXPECT_EQ(2U, GetChannels2().size()); | 1272 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1215 | 1273 |
| 1216 // RTCP can be sent before the call is accepted, if the transport is ready. | 1274 // RTCP can be sent before the call is accepted, if the transport is ready. |
| 1217 // It should not be muxed though, as the remote side doesn't support mux. | 1275 // It should not be muxed though, as the remote side doesn't support mux. |
| 1218 SendRtcp1(); | 1276 SendRtcp1(); |
| 1219 WaitForThreads(); | 1277 WaitForThreads(); |
| 1220 EXPECT_TRUE(CheckNoRtp2()); | 1278 EXPECT_TRUE(CheckNoRtp2()); |
| 1221 EXPECT_TRUE(CheckRtcp2()); | 1279 EXPECT_TRUE(CheckRtcp2()); |
| 1222 | 1280 |
| 1223 // Send RTCP packet from callee and verify that it is received. | 1281 // Send RTCP packet from callee and verify that it is received. |
| 1224 SendRtcp2(); | 1282 SendRtcp2(); |
| 1225 WaitForThreads(); | 1283 WaitForThreads(); |
| 1226 EXPECT_TRUE(CheckNoRtp1()); | 1284 EXPECT_TRUE(CheckNoRtp1()); |
| 1227 EXPECT_TRUE(CheckRtcp1()); | 1285 EXPECT_TRUE(CheckRtcp1()); |
| 1228 | 1286 |
| 1229 // Complete call setup and ensure everything is still OK. | 1287 // Complete call setup and ensure everything is still OK. |
| 1230 EXPECT_TRUE(SendAccept()); | 1288 EXPECT_TRUE(SendAccept()); |
| 1231 EXPECT_EQ(2U, GetChannels1().size()); | 1289 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1232 SendRtcp1(); | 1290 SendRtcp1(); |
| 1233 SendRtcp2(); | 1291 SendRtcp2(); |
| 1234 WaitForThreads(); | 1292 WaitForThreads(); |
| 1235 EXPECT_TRUE(CheckRtcp2()); | 1293 EXPECT_TRUE(CheckRtcp2()); |
| 1236 EXPECT_TRUE(CheckRtcp1()); | 1294 EXPECT_TRUE(CheckRtcp1()); |
| 1237 } | 1295 } |
| 1238 | 1296 |
| 1239 | 1297 |
| 1240 // Check that RTCP data is not muxed until both sides have enabled muxing, | 1298 // Check that RTCP data is not muxed until both sides have enabled muxing, |
| 1241 // but that we properly demux before we get the accept message, since there | 1299 // but that we properly demux before we get the accept message, since there |
| 1242 // is a race between RTP data and the jingle accept. | 1300 // is a race between RTP data and the jingle accept. |
| 1243 void SendEarlyRtcpMuxToRtcpMux() { | 1301 void SendEarlyRtcpMuxToRtcpMux() { |
| 1244 CreateChannels(RTCP_MUX, RTCP_MUX); | 1302 CreateChannels(RTCP_MUX, RTCP_MUX); |
| 1245 EXPECT_TRUE(SendInitiate()); | 1303 EXPECT_TRUE(SendInitiate()); |
| 1246 EXPECT_EQ(2U, GetChannels1().size()); | 1304 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1247 EXPECT_EQ(1U, GetChannels2().size()); | 1305 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1248 | 1306 |
| 1249 // RTCP can't be sent yet, since the RTCP transport isn't writable, and | 1307 // RTCP can't be sent yet, since the RTCP transport isn't writable, and |
| 1250 // we haven't yet received the accept that says we should mux. | 1308 // we haven't yet received the accept that says we should mux. |
| 1251 SendRtcp1(); | 1309 SendRtcp1(); |
| 1252 WaitForThreads(); | 1310 WaitForThreads(); |
| 1253 EXPECT_TRUE(CheckNoRtcp2()); | 1311 EXPECT_TRUE(CheckNoRtcp2()); |
| 1254 | 1312 |
| 1255 // Send muxed RTCP packet from callee and verify that it is received. | 1313 // Send muxed RTCP packet from callee and verify that it is received. |
| 1256 SendRtcp2(); | 1314 SendRtcp2(); |
| 1257 WaitForThreads(); | 1315 WaitForThreads(); |
| 1258 EXPECT_TRUE(CheckNoRtp1()); | 1316 EXPECT_TRUE(CheckNoRtp1()); |
| 1259 EXPECT_TRUE(CheckRtcp1()); | 1317 EXPECT_TRUE(CheckRtcp1()); |
| 1260 | 1318 |
| 1261 // Complete call setup and ensure everything is still OK. | 1319 // Complete call setup and ensure everything is still OK. |
| 1320 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 1262 EXPECT_TRUE(SendAccept()); | 1321 EXPECT_TRUE(SendAccept()); |
| 1263 EXPECT_EQ(1U, GetChannels1().size()); | 1322 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1323 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 1264 SendRtcp1(); | 1324 SendRtcp1(); |
| 1265 SendRtcp2(); | 1325 SendRtcp2(); |
| 1266 WaitForThreads(); | 1326 WaitForThreads(); |
| 1267 EXPECT_TRUE(CheckRtcp2()); | 1327 EXPECT_TRUE(CheckRtcp2()); |
| 1268 EXPECT_TRUE(CheckRtcp1()); | 1328 EXPECT_TRUE(CheckRtcp1()); |
| 1269 } | 1329 } |
| 1270 | 1330 |
| 1271 // Test that we properly send SRTP with RTCP in both directions. | 1331 // Test that we properly send SRTP with RTCP in both directions. |
| 1272 // You can pass in DTLS and/or RTCP_MUX as flags. | 1332 // You can pass in DTLS, RTCP_MUX, GCM_CIPHER and RAW_PACKET_TRANSPORT as |
| 1333 // flags. |
| 1273 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { | 1334 void SendSrtpToSrtp(int flags1_in = 0, int flags2_in = 0) { |
| 1274 RTC_CHECK((flags1_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 1335 RTC_CHECK((flags1_in & |
| 1275 RTC_CHECK((flags2_in & ~(RTCP_MUX | DTLS | GCM_CIPHER)) == 0); | 1336 ~(RTCP_MUX | DTLS | GCM_CIPHER | RAW_PACKET_TRANSPORT)) == 0); |
| 1337 RTC_CHECK((flags2_in & |
| 1338 ~(RTCP_MUX | DTLS | GCM_CIPHER | RAW_PACKET_TRANSPORT)) == 0); |
| 1276 | 1339 |
| 1277 int flags1 = SECURE | flags1_in; | 1340 int flags1 = SECURE | flags1_in; |
| 1278 int flags2 = SECURE | flags2_in; | 1341 int flags2 = SECURE | flags2_in; |
| 1279 bool dtls1 = !!(flags1_in & DTLS); | 1342 bool dtls1 = !!(flags1_in & DTLS); |
| 1280 bool dtls2 = !!(flags2_in & DTLS); | 1343 bool dtls2 = !!(flags2_in & DTLS); |
| 1281 CreateChannels(flags1, flags2); | 1344 CreateChannels(flags1, flags2); |
| 1282 EXPECT_FALSE(channel1_->secure()); | 1345 EXPECT_FALSE(channel1_->secure()); |
| 1283 EXPECT_FALSE(channel2_->secure()); | 1346 EXPECT_FALSE(channel2_->secure()); |
| 1284 EXPECT_TRUE(SendInitiate()); | 1347 EXPECT_TRUE(SendInitiate()); |
| 1285 WaitForThreads(); | 1348 WaitForThreads(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. | 1404 // sent and received. The test uses SRTP, RTCP mux and SSRC mux. |
| 1342 void SendEarlyMediaUsingRtcpMuxSrtp() { | 1405 void SendEarlyMediaUsingRtcpMuxSrtp() { |
| 1343 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1406 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
| 1344 | 1407 |
| 1345 CreateChannels(SSRC_MUX | RTCP_MUX | SECURE, | 1408 CreateChannels(SSRC_MUX | RTCP_MUX | SECURE, |
| 1346 SSRC_MUX | RTCP_MUX | SECURE); | 1409 SSRC_MUX | RTCP_MUX | SECURE); |
| 1347 EXPECT_TRUE(SendOffer()); | 1410 EXPECT_TRUE(SendOffer()); |
| 1348 EXPECT_TRUE(SendProvisionalAnswer()); | 1411 EXPECT_TRUE(SendProvisionalAnswer()); |
| 1349 EXPECT_TRUE(channel1_->secure()); | 1412 EXPECT_TRUE(channel1_->secure()); |
| 1350 EXPECT_TRUE(channel2_->secure()); | 1413 EXPECT_TRUE(channel2_->secure()); |
| 1351 EXPECT_EQ(2U, GetChannels1().size()); | 1414 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1352 EXPECT_EQ(2U, GetChannels2().size()); | 1415 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1353 WaitForThreads(); // Wait for 'sending' flag go through network thread. | 1416 WaitForThreads(); // Wait for 'sending' flag go through network thread. |
| 1354 SendCustomRtcp1(kSsrc1); | 1417 SendCustomRtcp1(kSsrc1); |
| 1355 SendCustomRtp1(kSsrc1, ++sequence_number1_1); | 1418 SendCustomRtp1(kSsrc1, ++sequence_number1_1); |
| 1356 WaitForThreads(); | 1419 WaitForThreads(); |
| 1357 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1420 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
| 1358 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1421 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
| 1359 | 1422 |
| 1360 // Send packets from callee and verify that it is received. | 1423 // Send packets from callee and verify that it is received. |
| 1361 SendCustomRtcp2(kSsrc2); | 1424 SendCustomRtcp2(kSsrc2); |
| 1362 SendCustomRtp2(kSsrc2, ++sequence_number2_2); | 1425 SendCustomRtp2(kSsrc2, ++sequence_number2_2); |
| 1363 WaitForThreads(); | 1426 WaitForThreads(); |
| 1364 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1427 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
| 1365 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); | 1428 EXPECT_TRUE(CheckCustomRtp1(kSsrc2, sequence_number2_2)); |
| 1366 | 1429 |
| 1367 // Complete call setup and ensure everything is still OK. | 1430 // Complete call setup and ensure everything is still OK. |
| 1431 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 1432 EXPECT_EQ(0, rtcp_mux_activated_callbacks2_); |
| 1368 EXPECT_TRUE(SendFinalAnswer()); | 1433 EXPECT_TRUE(SendFinalAnswer()); |
| 1369 EXPECT_EQ(1U, GetChannels1().size()); | 1434 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1370 EXPECT_EQ(1U, GetChannels2().size()); | 1435 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1436 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 1437 EXPECT_EQ(1, rtcp_mux_activated_callbacks2_); |
| 1371 EXPECT_TRUE(channel1_->secure()); | 1438 EXPECT_TRUE(channel1_->secure()); |
| 1372 EXPECT_TRUE(channel2_->secure()); | 1439 EXPECT_TRUE(channel2_->secure()); |
| 1373 SendCustomRtcp1(kSsrc1); | 1440 SendCustomRtcp1(kSsrc1); |
| 1374 SendCustomRtp1(kSsrc1, ++sequence_number1_1); | 1441 SendCustomRtp1(kSsrc1, ++sequence_number1_1); |
| 1375 SendCustomRtcp2(kSsrc2); | 1442 SendCustomRtcp2(kSsrc2); |
| 1376 SendCustomRtp2(kSsrc2, ++sequence_number2_2); | 1443 SendCustomRtp2(kSsrc2, ++sequence_number2_2); |
| 1377 WaitForThreads(); | 1444 WaitForThreads(); |
| 1378 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); | 1445 EXPECT_TRUE(CheckCustomRtcp2(kSsrc1)); |
| 1379 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); | 1446 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1)); |
| 1380 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); | 1447 EXPECT_TRUE(CheckCustomRtcp1(kSsrc2)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 EXPECT_TRUE(CheckNoRtcp1()); | 1493 EXPECT_TRUE(CheckNoRtcp1()); |
| 1427 EXPECT_TRUE(CheckNoRtcp2()); | 1494 EXPECT_TRUE(CheckNoRtcp2()); |
| 1428 } | 1495 } |
| 1429 | 1496 |
| 1430 // Test that the mediachannel retains its sending state after the transport | 1497 // Test that the mediachannel retains its sending state after the transport |
| 1431 // becomes non-writable. | 1498 // becomes non-writable. |
| 1432 void SendWithWritabilityLoss() { | 1499 void SendWithWritabilityLoss() { |
| 1433 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); | 1500 CreateChannels(RTCP_MUX | RTCP_MUX_REQUIRED, RTCP_MUX | RTCP_MUX_REQUIRED); |
| 1434 EXPECT_TRUE(SendInitiate()); | 1501 EXPECT_TRUE(SendInitiate()); |
| 1435 EXPECT_TRUE(SendAccept()); | 1502 EXPECT_TRUE(SendAccept()); |
| 1436 EXPECT_EQ(1U, GetChannels1().size()); | 1503 EXPECT_FALSE(channel1_->NeedsRtcpTransport()); |
| 1437 EXPECT_EQ(1U, GetChannels2().size()); | 1504 EXPECT_FALSE(channel2_->NeedsRtcpTransport()); |
| 1438 SendRtp1(); | 1505 SendRtp1(); |
| 1439 SendRtp2(); | 1506 SendRtp2(); |
| 1440 WaitForThreads(); | 1507 WaitForThreads(); |
| 1441 EXPECT_TRUE(CheckRtp1()); | 1508 EXPECT_TRUE(CheckRtp1()); |
| 1442 EXPECT_TRUE(CheckRtp2()); | 1509 EXPECT_TRUE(CheckRtp2()); |
| 1443 EXPECT_TRUE(CheckNoRtp1()); | 1510 EXPECT_TRUE(CheckNoRtp1()); |
| 1444 EXPECT_TRUE(CheckNoRtp2()); | 1511 EXPECT_TRUE(CheckNoRtp2()); |
| 1445 | 1512 |
| 1446 // Lose writability, which should fail. | 1513 // Lose writability, which should fail. |
| 1447 network_thread_->Invoke<void>( | 1514 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1448 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(false); }); | 1515 fake_rtp_dtls_transport1_->SetWritable(false); |
| 1516 }); |
| 1449 SendRtp1(); | 1517 SendRtp1(); |
| 1450 SendRtp2(); | 1518 SendRtp2(); |
| 1451 WaitForThreads(); | 1519 WaitForThreads(); |
| 1452 EXPECT_TRUE(CheckRtp1()); | 1520 EXPECT_TRUE(CheckRtp1()); |
| 1453 EXPECT_TRUE(CheckNoRtp2()); | 1521 EXPECT_TRUE(CheckNoRtp2()); |
| 1454 | 1522 |
| 1455 // Regain writability | 1523 // Regain writability |
| 1456 network_thread_->Invoke<void>( | 1524 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1457 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetWritable(true); }); | 1525 fake_rtp_dtls_transport1_->SetWritable(true); |
| 1526 }); |
| 1458 EXPECT_TRUE(media_channel1_->sending()); | 1527 EXPECT_TRUE(media_channel1_->sending()); |
| 1459 SendRtp1(); | 1528 SendRtp1(); |
| 1460 SendRtp2(); | 1529 SendRtp2(); |
| 1461 WaitForThreads(); | 1530 WaitForThreads(); |
| 1462 EXPECT_TRUE(CheckRtp1()); | 1531 EXPECT_TRUE(CheckRtp1()); |
| 1463 EXPECT_TRUE(CheckRtp2()); | 1532 EXPECT_TRUE(CheckRtp2()); |
| 1464 EXPECT_TRUE(CheckNoRtp1()); | 1533 EXPECT_TRUE(CheckNoRtp1()); |
| 1465 EXPECT_TRUE(CheckNoRtp2()); | 1534 EXPECT_TRUE(CheckNoRtp2()); |
| 1466 | 1535 |
| 1467 // Lose writability completely | 1536 // Lose writability completely |
| 1468 network_thread_->Invoke<void>( | 1537 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1469 RTC_FROM_HERE, [this] { GetFakeChannel1(1)->SetDestination(nullptr); }); | 1538 bool asymmetric = true; |
| 1539 fake_rtp_dtls_transport1_->SetDestination(nullptr, asymmetric); |
| 1540 }); |
| 1470 EXPECT_TRUE(media_channel1_->sending()); | 1541 EXPECT_TRUE(media_channel1_->sending()); |
| 1471 | 1542 |
| 1472 // Should fail also. | 1543 // Should fail also. |
| 1473 SendRtp1(); | 1544 SendRtp1(); |
| 1474 SendRtp2(); | 1545 SendRtp2(); |
| 1475 WaitForThreads(); | 1546 WaitForThreads(); |
| 1476 EXPECT_TRUE(CheckRtp1()); | 1547 EXPECT_TRUE(CheckRtp1()); |
| 1477 EXPECT_TRUE(CheckNoRtp2()); | 1548 EXPECT_TRUE(CheckNoRtp2()); |
| 1478 EXPECT_TRUE(CheckNoRtp1()); | 1549 EXPECT_TRUE(CheckNoRtp1()); |
| 1479 | 1550 |
| 1480 // Gain writability back | 1551 // Gain writability back |
| 1481 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1552 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1482 GetFakeChannel1(1)->SetDestination(GetFakeChannel2(1)); | 1553 bool asymmetric = true; |
| 1554 fake_rtp_dtls_transport1_->SetDestination(fake_rtp_dtls_transport2_.get(), |
| 1555 asymmetric); |
| 1483 }); | 1556 }); |
| 1484 EXPECT_TRUE(media_channel1_->sending()); | 1557 EXPECT_TRUE(media_channel1_->sending()); |
| 1485 SendRtp1(); | 1558 SendRtp1(); |
| 1486 SendRtp2(); | 1559 SendRtp2(); |
| 1487 WaitForThreads(); | 1560 WaitForThreads(); |
| 1488 EXPECT_TRUE(CheckRtp1()); | 1561 EXPECT_TRUE(CheckRtp1()); |
| 1489 EXPECT_TRUE(CheckRtp2()); | 1562 EXPECT_TRUE(CheckRtp2()); |
| 1490 EXPECT_TRUE(CheckNoRtp1()); | 1563 EXPECT_TRUE(CheckNoRtp1()); |
| 1491 EXPECT_TRUE(CheckNoRtp2()); | 1564 EXPECT_TRUE(CheckNoRtp2()); |
| 1492 } | 1565 } |
| 1493 | 1566 |
| 1494 void SendBundleToBundle( | 1567 void SendBundleToBundle( |
| 1495 const int* pl_types, int len, bool rtcp_mux, bool secure) { | 1568 const int* pl_types, int len, bool rtcp_mux, bool secure) { |
| 1496 ASSERT_EQ(2, len); | 1569 ASSERT_EQ(2, len); |
| 1497 int sequence_number1_1 = 0, sequence_number2_2 = 0; | 1570 int sequence_number1_1 = 0, sequence_number2_2 = 0; |
| 1498 // Only pl_type1 was added to the bundle filter for both |channel1_| | 1571 // Only pl_type1 was added to the bundle filter for both |channel1_| |
| 1499 // and |channel2_|. | 1572 // and |channel2_|. |
| 1500 int pl_type1 = pl_types[0]; | 1573 int pl_type1 = pl_types[0]; |
| 1501 int pl_type2 = pl_types[1]; | 1574 int pl_type2 = pl_types[1]; |
| 1502 int flags = SSRC_MUX; | 1575 int flags = SSRC_MUX; |
| 1503 if (secure) flags |= SECURE; | 1576 if (secure) flags |= SECURE; |
| 1504 uint32_t expected_channels = 2U; | |
| 1505 if (rtcp_mux) { | 1577 if (rtcp_mux) { |
| 1506 flags |= RTCP_MUX; | 1578 flags |= RTCP_MUX; |
| 1507 expected_channels = 1U; | |
| 1508 } | 1579 } |
| 1509 CreateChannels(flags, flags); | 1580 CreateChannels(flags, flags); |
| 1510 EXPECT_TRUE(SendInitiate()); | 1581 EXPECT_TRUE(SendInitiate()); |
| 1511 EXPECT_EQ(2U, GetChannels1().size()); | 1582 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1512 EXPECT_EQ(expected_channels, GetChannels2().size()); | 1583 EXPECT_EQ(rtcp_mux, !channel2_->NeedsRtcpTransport()); |
| 1513 EXPECT_TRUE(SendAccept()); | 1584 EXPECT_TRUE(SendAccept()); |
| 1514 EXPECT_EQ(expected_channels, GetChannels1().size()); | 1585 EXPECT_EQ(rtcp_mux, !channel1_->NeedsRtcpTransport()); |
| 1515 EXPECT_EQ(expected_channels, GetChannels2().size()); | 1586 EXPECT_EQ(rtcp_mux, !channel2_->NeedsRtcpTransport()); |
| 1516 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); | 1587 EXPECT_TRUE(channel1_->bundle_filter()->FindPayloadType(pl_type1)); |
| 1517 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); | 1588 EXPECT_TRUE(channel2_->bundle_filter()->FindPayloadType(pl_type1)); |
| 1518 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); | 1589 EXPECT_FALSE(channel1_->bundle_filter()->FindPayloadType(pl_type2)); |
| 1519 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); | 1590 EXPECT_FALSE(channel2_->bundle_filter()->FindPayloadType(pl_type2)); |
| 1520 | 1591 |
| 1521 // Both channels can receive pl_type1 only. | 1592 // Both channels can receive pl_type1 only. |
| 1522 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1); | 1593 SendCustomRtp1(kSsrc1, ++sequence_number1_1, pl_type1); |
| 1523 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1); | 1594 SendCustomRtp2(kSsrc2, ++sequence_number2_2, pl_type1); |
| 1524 WaitForThreads(); | 1595 WaitForThreads(); |
| 1525 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1)); | 1596 EXPECT_TRUE(CheckCustomRtp2(kSsrc1, sequence_number1_1, pl_type1)); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 sdesc3.get(), cricket::CA_ANSWER, &err)); | 1756 sdesc3.get(), cricket::CA_ANSWER, &err)); |
| 1686 EXPECT_TRUE(media_channel1_->HasSendStream(1)); | 1757 EXPECT_TRUE(media_channel1_->HasSendStream(1)); |
| 1687 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); | 1758 EXPECT_FALSE(media_channel1_->HasRecvStream(2)); |
| 1688 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); | 1759 EXPECT_TRUE(media_channel1_->HasRecvStream(3)); |
| 1689 } | 1760 } |
| 1690 | 1761 |
| 1691 void TestFlushRtcp() { | 1762 void TestFlushRtcp() { |
| 1692 CreateChannels(0, 0); | 1763 CreateChannels(0, 0); |
| 1693 EXPECT_TRUE(SendInitiate()); | 1764 EXPECT_TRUE(SendInitiate()); |
| 1694 EXPECT_TRUE(SendAccept()); | 1765 EXPECT_TRUE(SendAccept()); |
| 1695 EXPECT_EQ(2U, GetChannels1().size()); | 1766 EXPECT_TRUE(channel1_->NeedsRtcpTransport()); |
| 1696 EXPECT_EQ(2U, GetChannels2().size()); | 1767 EXPECT_TRUE(channel2_->NeedsRtcpTransport()); |
| 1697 | 1768 |
| 1698 // Send RTCP1 from a different thread. | 1769 // Send RTCP1 from a different thread. |
| 1699 ScopedCallThread send_rtcp([this] { SendRtcp1(); }); | 1770 ScopedCallThread send_rtcp([this] { SendRtcp1(); }); |
| 1700 // The sending message is only posted. channel2_ should be empty. | 1771 // The sending message is only posted. channel2_ should be empty. |
| 1701 EXPECT_TRUE(CheckNoRtcp2()); | 1772 EXPECT_TRUE(CheckNoRtcp2()); |
| 1702 rtc::Thread* wait_for[] = {send_rtcp.thread()}; | 1773 rtc::Thread* wait_for[] = {send_rtcp.thread()}; |
| 1703 WaitForThreads(wait_for); // Ensure rtcp was posted | 1774 WaitForThreads(wait_for); // Ensure rtcp was posted |
| 1704 | 1775 |
| 1705 // When channel1_ is deleted, the RTCP packet should be sent out to | 1776 // When channel1_ is deleted, the RTCP packet should be sent out to |
| 1706 // channel2_. | 1777 // channel2_. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 rtc::PacketOptions()); | 1849 rtc::PacketOptions()); |
| 1779 WaitForThreads(); | 1850 WaitForThreads(); |
| 1780 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1851 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
| 1781 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); | 1852 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); |
| 1782 | 1853 |
| 1783 // Testing failures in receiving packets. | 1854 // Testing failures in receiving packets. |
| 1784 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; | 1855 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; |
| 1785 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; | 1856 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; |
| 1786 | 1857 |
| 1787 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1858 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1788 cricket::DtlsTransportInternal* transport_channel = | 1859 fake_rtp_dtls_transport2_->SignalReadPacket( |
| 1789 channel2_->rtp_dtls_transport(); | 1860 fake_rtp_dtls_transport2_.get(), |
| 1790 transport_channel->SignalReadPacket( | 1861 reinterpret_cast<const char*>(kBadPacket), sizeof(kBadPacket), |
| 1791 transport_channel, reinterpret_cast<const char*>(kBadPacket), | 1862 rtc::PacketTime(), 0); |
| 1792 sizeof(kBadPacket), rtc::PacketTime(), 0); | |
| 1793 }); | 1863 }); |
| 1794 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1864 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
| 1795 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); | 1865 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); |
| 1796 // Terminate channels before the fake clock is destroyed. | 1866 // Terminate channels before the fake clock is destroyed. |
| 1797 EXPECT_TRUE(SendTerminate()); | 1867 EXPECT_TRUE(SendTerminate()); |
| 1798 } | 1868 } |
| 1799 | 1869 |
| 1800 void TestOnReadyToSend() { | 1870 void TestOnReadyToSend() { |
| 1801 CreateChannels(0, 0); | 1871 CreateChannels(0, 0); |
| 1802 DtlsTransportInternal* rtp = channel1_->rtp_dtls_transport(); | 1872 cricket::FakeDtlsTransport* rtp = fake_rtp_dtls_transport1_.get(); |
| 1803 DtlsTransportInternal* rtcp = channel1_->rtcp_dtls_transport(); | 1873 cricket::FakeDtlsTransport* rtcp = fake_rtcp_dtls_transport1_.get(); |
| 1804 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1874 EXPECT_FALSE(media_channel1_->ready_to_send()); |
| 1805 | 1875 |
| 1806 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1876 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1807 [rtp] { rtp->SignalReadyToSend(rtp); }); | 1877 [rtp] { rtp->SignalReadyToSend(rtp); }); |
| 1808 WaitForThreads(); | 1878 WaitForThreads(); |
| 1809 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1879 EXPECT_FALSE(media_channel1_->ready_to_send()); |
| 1810 | 1880 |
| 1811 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1881 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1812 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); | 1882 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); |
| 1813 WaitForThreads(); | 1883 WaitForThreads(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1839 channel1_->SetTransportChannelReadyToSend(true, true); | 1909 channel1_->SetTransportChannelReadyToSend(true, true); |
| 1840 }); | 1910 }); |
| 1841 WaitForThreads(); | 1911 WaitForThreads(); |
| 1842 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1912 EXPECT_TRUE(media_channel1_->ready_to_send()); |
| 1843 } | 1913 } |
| 1844 | 1914 |
| 1845 void TestOnReadyToSendWithRtcpMux() { | 1915 void TestOnReadyToSendWithRtcpMux() { |
| 1846 CreateChannels(0, 0); | 1916 CreateChannels(0, 0); |
| 1847 typename T::Content content; | 1917 typename T::Content content; |
| 1848 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1918 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
| 1849 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1919 // Both sides agree on mux. Should signal that RTCP mux is fully active. |
| 1850 content.set_rtcp_mux(true); | 1920 content.set_rtcp_mux(true); |
| 1851 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1921 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
| 1922 EXPECT_EQ(0, rtcp_mux_activated_callbacks1_); |
| 1852 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1923 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
| 1853 EXPECT_TRUE(channel1_->rtcp_dtls_transport() == NULL); | 1924 EXPECT_EQ(1, rtcp_mux_activated_callbacks1_); |
| 1854 DtlsTransportInternal* rtp = channel1_->rtp_dtls_transport(); | 1925 cricket::FakeDtlsTransport* rtp = fake_rtp_dtls_transport1_.get(); |
| 1855 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1926 EXPECT_FALSE(media_channel1_->ready_to_send()); |
| 1856 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1927 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
| 1857 // should trigger the MediaChannel's OnReadyToSend. | 1928 // should trigger the MediaChannel's OnReadyToSend. |
| 1858 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1929 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1859 [rtp] { rtp->SignalReadyToSend(rtp); }); | 1930 [rtp] { rtp->SignalReadyToSend(rtp); }); |
| 1860 WaitForThreads(); | 1931 WaitForThreads(); |
| 1861 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1932 EXPECT_TRUE(media_channel1_->ready_to_send()); |
| 1862 | 1933 |
| 1863 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1934 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
| 1864 channel1_->SetTransportChannelReadyToSend(false, false); | 1935 channel1_->SetTransportChannelReadyToSend(false, false); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 RTC_FROM_HERE, [this] { ProcessThreadQueue(network_thread_); }); | 2006 RTC_FROM_HERE, [this] { ProcessThreadQueue(network_thread_); }); |
| 1936 } | 2007 } |
| 1937 // Worker thread = current Thread process received messages. | 2008 // Worker thread = current Thread process received messages. |
| 1938 ProcessThreadQueue(rtc::Thread::Current()); | 2009 ProcessThreadQueue(rtc::Thread::Current()); |
| 1939 } | 2010 } |
| 1940 // TODO(pbos): Remove playout from all media channels and let renderers mute | 2011 // TODO(pbos): Remove playout from all media channels and let renderers mute |
| 1941 // themselves. | 2012 // themselves. |
| 1942 const bool verify_playout_; | 2013 const bool verify_playout_; |
| 1943 std::unique_ptr<rtc::Thread> network_thread_keeper_; | 2014 std::unique_ptr<rtc::Thread> network_thread_keeper_; |
| 1944 rtc::Thread* network_thread_; | 2015 rtc::Thread* network_thread_; |
| 1945 std::unique_ptr<cricket::FakeTransportController> transport_controller1_; | 2016 std::unique_ptr<cricket::FakeDtlsTransport> fake_rtp_dtls_transport1_; |
| 1946 std::unique_ptr<cricket::FakeTransportController> transport_controller2_; | 2017 std::unique_ptr<cricket::FakeDtlsTransport> fake_rtcp_dtls_transport1_; |
| 2018 std::unique_ptr<cricket::FakeDtlsTransport> fake_rtp_dtls_transport2_; |
| 2019 std::unique_ptr<cricket::FakeDtlsTransport> fake_rtcp_dtls_transport2_; |
| 2020 std::unique_ptr<rtc::FakePacketTransport> fake_rtp_packet_transport1_; |
| 2021 std::unique_ptr<rtc::FakePacketTransport> fake_rtcp_packet_transport1_; |
| 2022 std::unique_ptr<rtc::FakePacketTransport> fake_rtp_packet_transport2_; |
| 2023 std::unique_ptr<rtc::FakePacketTransport> fake_rtcp_packet_transport2_; |
| 1947 cricket::FakeMediaEngine media_engine_; | 2024 cricket::FakeMediaEngine media_engine_; |
| 1948 // The media channels are owned by the voice channel objects below. | 2025 // The media channels are owned by the voice channel objects below. |
| 1949 typename T::MediaChannel* media_channel1_; | 2026 typename T::MediaChannel* media_channel1_ = nullptr; |
| 1950 typename T::MediaChannel* media_channel2_; | 2027 typename T::MediaChannel* media_channel2_ = nullptr; |
| 1951 std::unique_ptr<typename T::Channel> channel1_; | 2028 std::unique_ptr<typename T::Channel> channel1_; |
| 1952 std::unique_ptr<typename T::Channel> channel2_; | 2029 std::unique_ptr<typename T::Channel> channel2_; |
| 1953 typename T::Content local_media_content1_; | 2030 typename T::Content local_media_content1_; |
| 1954 typename T::Content local_media_content2_; | 2031 typename T::Content local_media_content2_; |
| 1955 typename T::Content remote_media_content1_; | 2032 typename T::Content remote_media_content1_; |
| 1956 typename T::Content remote_media_content2_; | 2033 typename T::Content remote_media_content2_; |
| 1957 // The RTP and RTCP packets to send in the tests. | 2034 // The RTP and RTCP packets to send in the tests. |
| 1958 rtc::Buffer rtp_packet_; | 2035 rtc::Buffer rtp_packet_; |
| 1959 rtc::Buffer rtcp_packet_; | 2036 rtc::Buffer rtcp_packet_; |
| 1960 int media_info_callbacks1_; | 2037 int media_info_callbacks1_ = 0; |
| 1961 int media_info_callbacks2_; | 2038 int media_info_callbacks2_ = 0; |
| 2039 int rtcp_mux_activated_callbacks1_ = 0; |
| 2040 int rtcp_mux_activated_callbacks2_ = 0; |
| 1962 cricket::CandidatePairInterface* last_selected_candidate_pair_; | 2041 cricket::CandidatePairInterface* last_selected_candidate_pair_; |
| 1963 }; | 2042 }; |
| 1964 | 2043 |
| 1965 template<> | 2044 template<> |
| 1966 void ChannelTest<VoiceTraits>::CreateContent( | 2045 void ChannelTest<VoiceTraits>::CreateContent( |
| 1967 int flags, | 2046 int flags, |
| 1968 const cricket::AudioCodec& audio_codec, | 2047 const cricket::AudioCodec& audio_codec, |
| 1969 const cricket::VideoCodec& video_codec, | 2048 const cricket::VideoCodec& video_codec, |
| 1970 cricket::AudioContentDescription* audio) { | 2049 cricket::AudioContentDescription* audio) { |
| 1971 audio->AddCodec(audio_codec); | 2050 audio->AddCodec(audio_codec); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2013 : Base(true, kPcmuFrame, kRtcpReport, NetworkIsWorker::No) {} | 2092 : Base(true, kPcmuFrame, kRtcpReport, NetworkIsWorker::No) {} |
| 2014 }; | 2093 }; |
| 2015 | 2094 |
| 2016 // override to add NULL parameter | 2095 // override to add NULL parameter |
| 2017 template <> | 2096 template <> |
| 2018 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 2097 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
| 2019 rtc::Thread* worker_thread, | 2098 rtc::Thread* worker_thread, |
| 2020 rtc::Thread* network_thread, | 2099 rtc::Thread* network_thread, |
| 2021 cricket::MediaEngineInterface* engine, | 2100 cricket::MediaEngineInterface* engine, |
| 2022 cricket::FakeVideoMediaChannel* ch, | 2101 cricket::FakeVideoMediaChannel* ch, |
| 2023 cricket::TransportController* transport_controller, | 2102 cricket::DtlsTransportInternal* fake_rtp_dtls_transport, |
| 2103 cricket::DtlsTransportInternal* fake_rtcp_dtls_transport, |
| 2104 rtc::PacketTransportInterface* fake_rtp_packet_transport, |
| 2105 rtc::PacketTransportInterface* fake_rtcp_packet_transport, |
| 2024 int flags) { | 2106 int flags) { |
| 2025 rtc::Thread* signaling_thread = | 2107 rtc::Thread* signaling_thread = rtc::Thread::Current(); |
| 2026 transport_controller ? transport_controller->signaling_thread() : nullptr; | |
| 2027 cricket::VideoChannel* channel = new cricket::VideoChannel( | 2108 cricket::VideoChannel* channel = new cricket::VideoChannel( |
| 2028 worker_thread, network_thread, signaling_thread, ch, cricket::CN_VIDEO, | 2109 worker_thread, network_thread, signaling_thread, ch, cricket::CN_VIDEO, |
| 2029 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); | 2110 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); |
| 2030 rtc::CryptoOptions crypto_options; | 2111 rtc::CryptoOptions crypto_options; |
| 2031 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 2112 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 2032 channel->SetCryptoOptions(crypto_options); | 2113 channel->SetCryptoOptions(crypto_options); |
| 2033 cricket::DtlsTransportInternal* rtp_dtls_transport = | 2114 if (!channel->NeedsRtcpTransport()) { |
| 2034 transport_controller->CreateDtlsTransport( | 2115 fake_rtcp_dtls_transport = nullptr; |
| 2035 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 2036 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; | |
| 2037 if (channel->NeedsRtcpTransport()) { | |
| 2038 rtcp_dtls_transport = transport_controller->CreateDtlsTransport( | |
| 2039 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 2040 } | 2116 } |
| 2041 if (!channel->Init_w(rtp_dtls_transport, rtcp_dtls_transport)) { | 2117 if (!channel->Init_w(fake_rtp_dtls_transport, fake_rtcp_dtls_transport, |
| 2118 fake_rtp_packet_transport, fake_rtcp_packet_transport)) { |
| 2042 delete channel; | 2119 delete channel; |
| 2043 channel = NULL; | 2120 channel = NULL; |
| 2044 } | 2121 } |
| 2045 return channel; | 2122 return channel; |
| 2046 } | 2123 } |
| 2047 | 2124 |
| 2048 // override to add 0 parameter | 2125 // override to add 0 parameter |
| 2049 template<> | 2126 template<> |
| 2050 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 2127 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
| 2051 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 2128 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2342 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2266 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2343 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2267 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2344 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2268 } | 2345 } |
| 2269 | 2346 |
| 2270 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2347 TEST_F(VoiceChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2271 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2348 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2272 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2349 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2273 } | 2350 } |
| 2274 | 2351 |
| 2352 // Test using the channel with a raw packet interface, as opposed to a DTLS |
| 2353 // transport interface. |
| 2354 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToSrtpWithRawPacketTransport) { |
| 2355 Base::SendSrtpToSrtp(RAW_PACKET_TRANSPORT, RAW_PACKET_TRANSPORT); |
| 2356 } |
| 2357 |
| 2275 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2358 TEST_F(VoiceChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2276 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2359 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2277 } | 2360 } |
| 2278 | 2361 |
| 2279 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { | 2362 TEST_F(VoiceChannelSingleThreadTest, SendRtpToRtpOnThread) { |
| 2280 Base::SendRtpToRtpOnThread(); | 2363 Base::SendRtpToRtpOnThread(); |
| 2281 } | 2364 } |
| 2282 | 2365 |
| 2283 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToSrtpOnThread) { | 2366 TEST_F(VoiceChannelSingleThreadTest, SendSrtpToSrtpOnThread) { |
| 2284 Base::SendSrtpToSrtpOnThread(); | 2367 Base::SendSrtpToSrtpOnThread(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { | 2681 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpGcmTwo) { |
| 2599 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2682 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2600 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); | 2683 Base::SendSrtpToSrtp(DTLS, DTLS | GCM_CIPHER); |
| 2601 } | 2684 } |
| 2602 | 2685 |
| 2603 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 2686 TEST_F(VoiceChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2604 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2687 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2605 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 2688 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2606 } | 2689 } |
| 2607 | 2690 |
| 2691 // Test using the channel with a raw packet interface, as opposed to a DTLS |
| 2692 // transport interface. |
| 2693 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToSrtpWithRawPacketTransport) { |
| 2694 Base::SendSrtpToSrtp(RAW_PACKET_TRANSPORT, RAW_PACKET_TRANSPORT); |
| 2695 } |
| 2696 |
| 2608 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 2697 TEST_F(VoiceChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2609 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 2698 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2610 } | 2699 } |
| 2611 | 2700 |
| 2612 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { | 2701 TEST_F(VoiceChannelDoubleThreadTest, SendRtpToRtpOnThread) { |
| 2613 Base::SendRtpToRtpOnThread(); | 2702 Base::SendRtpToRtpOnThread(); |
| 2614 } | 2703 } |
| 2615 | 2704 |
| 2616 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToSrtpOnThread) { | 2705 TEST_F(VoiceChannelDoubleThreadTest, SendSrtpToSrtpOnThread) { |
| 2617 Base::SendSrtpToSrtpOnThread(); | 2706 Base::SendSrtpToSrtpOnThread(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2908 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 2997 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 2909 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 2998 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2910 Base::SendSrtpToSrtp(DTLS, DTLS); | 2999 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 2911 } | 3000 } |
| 2912 | 3001 |
| 2913 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 3002 TEST_F(VideoChannelSingleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 2914 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 3003 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 2915 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 3004 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 2916 } | 3005 } |
| 2917 | 3006 |
| 3007 // Test using the channel with a raw packet interface, as opposed to a DTLS |
| 3008 // transport interface. |
| 3009 TEST_F(VideoChannelSingleThreadTest, SendSrtpToSrtpWithRawPacketTransport) { |
| 3010 Base::SendSrtpToSrtp(RAW_PACKET_TRANSPORT, RAW_PACKET_TRANSPORT); |
| 3011 } |
| 3012 |
| 2918 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { | 3013 TEST_F(VideoChannelSingleThreadTest, SendSrtcpMux) { |
| 2919 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 3014 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 2920 } | 3015 } |
| 2921 | 3016 |
| 2922 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 3017 TEST_F(VideoChannelSingleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 2923 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 3018 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 2924 } | 3019 } |
| 2925 | 3020 |
| 2926 TEST_F(VideoChannelSingleThreadTest, SendRtpToRtpOnThread) { | 3021 TEST_F(VideoChannelSingleThreadTest, SendRtpToRtpOnThread) { |
| 2927 Base::SendRtpToRtpOnThread(); | 3022 Base::SendRtpToRtpOnThread(); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { | 3235 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtp) { |
| 3141 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 3236 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 3142 Base::SendSrtpToSrtp(DTLS, DTLS); | 3237 Base::SendSrtpToSrtp(DTLS, DTLS); |
| 3143 } | 3238 } |
| 3144 | 3239 |
| 3145 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { | 3240 TEST_F(VideoChannelDoubleThreadTest, SendDtlsSrtpToDtlsSrtpRtcpMux) { |
| 3146 MAYBE_SKIP_TEST(HaveDtlsSrtp); | 3241 MAYBE_SKIP_TEST(HaveDtlsSrtp); |
| 3147 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); | 3242 Base::SendSrtpToSrtp(DTLS | RTCP_MUX, DTLS | RTCP_MUX); |
| 3148 } | 3243 } |
| 3149 | 3244 |
| 3245 // Test using the channel with a raw packet interface, as opposed to a DTLS |
| 3246 // transport interface. |
| 3247 TEST_F(VideoChannelDoubleThreadTest, SendSrtpToSrtpWithRawPacketTransport) { |
| 3248 Base::SendSrtpToSrtp(RAW_PACKET_TRANSPORT, RAW_PACKET_TRANSPORT); |
| 3249 } |
| 3250 |
| 3150 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { | 3251 TEST_F(VideoChannelDoubleThreadTest, SendSrtcpMux) { |
| 3151 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); | 3252 Base::SendSrtpToSrtp(RTCP_MUX, RTCP_MUX); |
| 3152 } | 3253 } |
| 3153 | 3254 |
| 3154 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { | 3255 TEST_F(VideoChannelDoubleThreadTest, SendEarlyMediaUsingRtcpMuxSrtp) { |
| 3155 Base::SendEarlyMediaUsingRtcpMuxSrtp(); | 3256 Base::SendEarlyMediaUsingRtcpMuxSrtp(); |
| 3156 } | 3257 } |
| 3157 | 3258 |
| 3158 TEST_F(VideoChannelDoubleThreadTest, SendRtpToRtpOnThread) { | 3259 TEST_F(VideoChannelDoubleThreadTest, SendRtpToRtpOnThread) { |
| 3159 Base::SendRtpToRtpOnThread(); | 3260 Base::SendRtpToRtpOnThread(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3247 : Base(true, kDataPacket, kRtcpReport, NetworkIsWorker::No) {} | 3348 : Base(true, kDataPacket, kRtcpReport, NetworkIsWorker::No) {} |
| 3248 }; | 3349 }; |
| 3249 | 3350 |
| 3250 // Override to avoid engine channel parameter. | 3351 // Override to avoid engine channel parameter. |
| 3251 template <> | 3352 template <> |
| 3252 cricket::RtpDataChannel* ChannelTest<DataTraits>::CreateChannel( | 3353 cricket::RtpDataChannel* ChannelTest<DataTraits>::CreateChannel( |
| 3253 rtc::Thread* worker_thread, | 3354 rtc::Thread* worker_thread, |
| 3254 rtc::Thread* network_thread, | 3355 rtc::Thread* network_thread, |
| 3255 cricket::MediaEngineInterface* engine, | 3356 cricket::MediaEngineInterface* engine, |
| 3256 cricket::FakeDataMediaChannel* ch, | 3357 cricket::FakeDataMediaChannel* ch, |
| 3257 cricket::TransportController* transport_controller, | 3358 cricket::DtlsTransportInternal* fake_rtp_dtls_transport, |
| 3359 cricket::DtlsTransportInternal* fake_rtcp_dtls_transport, |
| 3360 rtc::PacketTransportInterface* fake_rtp_packet_transport, |
| 3361 rtc::PacketTransportInterface* fake_rtcp_packet_transport, |
| 3258 int flags) { | 3362 int flags) { |
| 3259 rtc::Thread* signaling_thread = | 3363 rtc::Thread* signaling_thread = rtc::Thread::Current(); |
| 3260 transport_controller ? transport_controller->signaling_thread() : nullptr; | |
| 3261 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel( | 3364 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel( |
| 3262 worker_thread, network_thread, signaling_thread, ch, cricket::CN_DATA, | 3365 worker_thread, network_thread, signaling_thread, ch, cricket::CN_DATA, |
| 3263 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); | 3366 (flags & RTCP_MUX_REQUIRED) != 0, (flags & SECURE) != 0); |
| 3264 rtc::CryptoOptions crypto_options; | 3367 rtc::CryptoOptions crypto_options; |
| 3265 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 3368 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
| 3266 channel->SetCryptoOptions(crypto_options); | 3369 channel->SetCryptoOptions(crypto_options); |
| 3267 cricket::DtlsTransportInternal* rtp_dtls_transport = | 3370 if (!channel->NeedsRtcpTransport()) { |
| 3268 transport_controller->CreateDtlsTransport( | 3371 fake_rtcp_dtls_transport = nullptr; |
| 3269 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 3270 cricket::DtlsTransportInternal* rtcp_dtls_transport = nullptr; | |
| 3271 if (channel->NeedsRtcpTransport()) { | |
| 3272 rtcp_dtls_transport = transport_controller->CreateDtlsTransport( | |
| 3273 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 3274 } | 3372 } |
| 3275 if (!channel->Init_w(rtp_dtls_transport, rtcp_dtls_transport)) { | 3373 if (!channel->Init_w(fake_rtp_dtls_transport, fake_rtcp_dtls_transport, |
| 3374 fake_rtp_packet_transport, fake_rtcp_packet_transport)) { |
| 3276 delete channel; | 3375 delete channel; |
| 3277 channel = NULL; | 3376 channel = NULL; |
| 3278 } | 3377 } |
| 3279 return channel; | 3378 return channel; |
| 3280 } | 3379 } |
| 3281 | 3380 |
| 3282 template <> | 3381 template <> |
| 3283 void ChannelTest<DataTraits>::CreateContent( | 3382 void ChannelTest<DataTraits>::CreateContent( |
| 3284 int flags, | 3383 int flags, |
| 3285 const cricket::AudioCodec& audio_codec, | 3384 const cricket::AudioCodec& audio_codec, |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3681 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
| 3583 } | 3682 } |
| 3584 | 3683 |
| 3585 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 3684 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 3586 | 3685 |
| 3587 // Verifies some DCHECKs are in place. | 3686 // Verifies some DCHECKs are in place. |
| 3588 // Uses VoiceChannel, but any BaseChannel subclass would work. | 3687 // Uses VoiceChannel, but any BaseChannel subclass would work. |
| 3589 class BaseChannelDeathTest : public testing::Test { | 3688 class BaseChannelDeathTest : public testing::Test { |
| 3590 public: | 3689 public: |
| 3591 BaseChannelDeathTest() | 3690 BaseChannelDeathTest() |
| 3592 : // RTCP mux not required, SRTP required. | 3691 : fake_rtp_dtls_transport_("foo", cricket::ICE_CANDIDATE_COMPONENT_RTP), |
| 3692 fake_rtcp_dtls_transport_("foo", cricket::ICE_CANDIDATE_COMPONENT_RTCP), |
| 3693 // RTCP mux not required, SRTP required. |
| 3593 voice_channel_( | 3694 voice_channel_( |
| 3594 rtc::Thread::Current(), | 3695 rtc::Thread::Current(), |
| 3595 rtc::Thread::Current(), | 3696 rtc::Thread::Current(), |
| 3596 rtc::Thread::Current(), | 3697 rtc::Thread::Current(), |
| 3597 &fake_media_engine_, | 3698 &fake_media_engine_, |
| 3598 new cricket::FakeVoiceMediaChannel(nullptr, | 3699 new cricket::FakeVoiceMediaChannel(nullptr, |
| 3599 cricket::AudioOptions()), | 3700 cricket::AudioOptions()), |
| 3600 cricket::CN_AUDIO, | 3701 cricket::CN_AUDIO, |
| 3601 false, | 3702 false, |
| 3602 true) { | 3703 true) {} |
| 3603 rtp_transport_ = fake_transport_controller_.CreateDtlsTransport( | |
| 3604 "foo", cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 3605 rtcp_transport_ = fake_transport_controller_.CreateDtlsTransport( | |
| 3606 "foo", cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 3607 EXPECT_TRUE(voice_channel_.Init_w(rtp_transport_, rtcp_transport_)); | |
| 3608 } | |
| 3609 | 3704 |
| 3610 protected: | 3705 protected: |
| 3611 cricket::FakeTransportController fake_transport_controller_; | |
| 3612 cricket::FakeMediaEngine fake_media_engine_; | 3706 cricket::FakeMediaEngine fake_media_engine_; |
| 3707 cricket::FakeDtlsTransport fake_rtp_dtls_transport_; |
| 3708 cricket::FakeDtlsTransport fake_rtcp_dtls_transport_; |
| 3613 cricket::VoiceChannel voice_channel_; | 3709 cricket::VoiceChannel voice_channel_; |
| 3614 // Will be cleaned up by FakeTransportController, don't need to worry about | |
| 3615 // deleting them in this test. | |
| 3616 cricket::DtlsTransportInternal* rtp_transport_; | |
| 3617 cricket::DtlsTransportInternal* rtcp_transport_; | |
| 3618 }; | 3710 }; |
| 3619 | 3711 |
| 3620 TEST_F(BaseChannelDeathTest, SetTransportWithNullRtpTransport) { | 3712 TEST_F(BaseChannelDeathTest, SetTransportsWithNullRtpTransport) { |
| 3621 cricket::DtlsTransportInternal* new_rtcp_transport = | 3713 ASSERT_TRUE(voice_channel_.Init_w( |
| 3622 fake_transport_controller_.CreateDtlsTransport( | 3714 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_, |
| 3623 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 3715 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_)); |
| 3624 EXPECT_DEATH(voice_channel_.SetTransports(nullptr, new_rtcp_transport), ""); | 3716 cricket::FakeDtlsTransport new_rtcp_transport( |
| 3717 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3718 EXPECT_DEATH(voice_channel_.SetTransports(nullptr, &new_rtcp_transport), ""); |
| 3625 } | 3719 } |
| 3626 | 3720 |
| 3627 TEST_F(BaseChannelDeathTest, SetTransportWithMissingRtcpTransport) { | 3721 TEST_F(BaseChannelDeathTest, SetTransportsWithMissingRtcpTransport) { |
| 3628 cricket::DtlsTransportInternal* new_rtp_transport = | 3722 ASSERT_TRUE(voice_channel_.Init_w( |
| 3629 fake_transport_controller_.CreateDtlsTransport( | 3723 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_, |
| 3630 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); | 3724 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_)); |
| 3631 EXPECT_DEATH(voice_channel_.SetTransports(new_rtp_transport, nullptr), ""); | 3725 cricket::FakeDtlsTransport new_rtp_transport( |
| 3726 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3727 EXPECT_DEATH(voice_channel_.SetTransports(&new_rtp_transport, nullptr), ""); |
| 3632 } | 3728 } |
| 3633 | 3729 |
| 3634 TEST_F(BaseChannelDeathTest, SetTransportWithUnneededRtcpTransport) { | 3730 TEST_F(BaseChannelDeathTest, SetTransportsWithUnneededRtcpTransport) { |
| 3731 ASSERT_TRUE(voice_channel_.Init_w( |
| 3732 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_, |
| 3733 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_)); |
| 3635 // Activate RTCP muxing, simulating offer/answer negotiation. | 3734 // Activate RTCP muxing, simulating offer/answer negotiation. |
| 3636 cricket::AudioContentDescription content; | 3735 cricket::AudioContentDescription content; |
| 3637 content.set_rtcp_mux(true); | 3736 content.set_rtcp_mux(true); |
| 3638 ASSERT_TRUE(voice_channel_.SetLocalContent(&content, CA_OFFER, nullptr)); | 3737 ASSERT_TRUE(voice_channel_.SetLocalContent(&content, CA_OFFER, nullptr)); |
| 3639 ASSERT_TRUE(voice_channel_.SetRemoteContent(&content, CA_ANSWER, nullptr)); | 3738 ASSERT_TRUE(voice_channel_.SetRemoteContent(&content, CA_ANSWER, nullptr)); |
| 3640 cricket::DtlsTransportInternal* new_rtp_transport = | 3739 cricket::FakeDtlsTransport new_rtp_transport( |
| 3641 fake_transport_controller_.CreateDtlsTransport( | 3740 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3642 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); | 3741 cricket::FakeDtlsTransport new_rtcp_transport( |
| 3643 cricket::DtlsTransportInternal* new_rtcp_transport = | 3742 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3644 fake_transport_controller_.CreateDtlsTransport( | |
| 3645 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTCP); | |
| 3646 // After muxing is enabled, no RTCP transport should be passed in here. | 3743 // After muxing is enabled, no RTCP transport should be passed in here. |
| 3647 EXPECT_DEATH( | 3744 EXPECT_DEATH( |
| 3648 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); | 3745 voice_channel_.SetTransports(&new_rtp_transport, &new_rtcp_transport), |
| 3746 ""); |
| 3649 } | 3747 } |
| 3650 | 3748 |
| 3651 // This test will probably go away if/when we move the transport name out of | 3749 // This test will probably go away if/when we move the transport name out of |
| 3652 // the transport classes and into their parent classes. | 3750 // the transport classes and into their parent classes. |
| 3653 TEST_F(BaseChannelDeathTest, SetTransportWithMismatchingTransportNames) { | 3751 TEST_F(BaseChannelDeathTest, SetTransportsWithMismatchingTransportNames) { |
| 3654 cricket::DtlsTransportInternal* new_rtp_transport = | 3752 ASSERT_TRUE(voice_channel_.Init_w( |
| 3655 fake_transport_controller_.CreateDtlsTransport( | 3753 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_, |
| 3656 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); | 3754 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_)); |
| 3657 cricket::DtlsTransportInternal* new_rtcp_transport = | 3755 cricket::FakeDtlsTransport new_rtp_transport( |
| 3658 fake_transport_controller_.CreateDtlsTransport( | 3756 "bar", cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3659 "baz", cricket::ICE_CANDIDATE_COMPONENT_RTCP); | 3757 cricket::FakeDtlsTransport new_rtcp_transport( |
| 3758 "baz", cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3660 EXPECT_DEATH( | 3759 EXPECT_DEATH( |
| 3661 voice_channel_.SetTransports(new_rtp_transport, new_rtcp_transport), ""); | 3760 voice_channel_.SetTransports(&new_rtp_transport, &new_rtcp_transport), |
| 3761 ""); |
| 3762 } |
| 3763 |
| 3764 // Not expected to support going from DtlsTransportInternal to |
| 3765 // PacketTransportInterface. |
| 3766 TEST_F(BaseChannelDeathTest, SetTransportsDtlsToNonDtls) { |
| 3767 ASSERT_TRUE(voice_channel_.Init_w( |
| 3768 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_, |
| 3769 &fake_rtp_dtls_transport_, &fake_rtcp_dtls_transport_)); |
| 3770 EXPECT_DEATH( |
| 3771 voice_channel_.SetTransports(static_cast<rtc::PacketTransportInterface*>( |
| 3772 &fake_rtp_dtls_transport_), |
| 3773 static_cast<rtc::PacketTransportInterface*>( |
| 3774 &fake_rtp_dtls_transport_)), |
| 3775 ""); |
| 3776 } |
| 3777 |
| 3778 // Not expected to support going from PacketTransportInterface to |
| 3779 // DtlsTransportInternal. |
| 3780 TEST_F(BaseChannelDeathTest, SetTransportsNonDtlsToDtls) { |
| 3781 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_, |
| 3782 &fake_rtcp_dtls_transport_)); |
| 3783 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_, |
| 3784 &fake_rtp_dtls_transport_), |
| 3785 ""); |
| 3662 } | 3786 } |
| 3663 | 3787 |
| 3664 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 3788 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
| 3665 | 3789 |
| 3666 // TODO(pthatcher): TestSetReceiver? | 3790 // TODO(pthatcher): TestSetReceiver? |
| OLD | NEW |