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 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 channel1_.reset( | 138 channel1_.reset( |
139 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, | 139 CreateChannel(worker_thread, network_thread_, &media_engine_, ch1, |
140 transport_controller1_.get(), flags1)); | 140 transport_controller1_.get(), flags1)); |
141 channel2_.reset( | 141 channel2_.reset( |
142 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, | 142 CreateChannel(worker_thread, network_thread_, &media_engine_, ch2, |
143 transport_controller2_.get(), flags2)); | 143 transport_controller2_.get(), flags2)); |
144 channel1_->SignalMediaMonitor.connect(this, | 144 channel1_->SignalMediaMonitor.connect(this, |
145 &ChannelTest<T>::OnMediaMonitor1); | 145 &ChannelTest<T>::OnMediaMonitor1); |
146 channel2_->SignalMediaMonitor.connect(this, | 146 channel2_->SignalMediaMonitor.connect(this, |
147 &ChannelTest<T>::OnMediaMonitor2); | 147 &ChannelTest<T>::OnMediaMonitor2); |
| 148 channel1_->SignalDestroyRtcpTransport.connect( |
| 149 transport_controller1_.get(), |
| 150 &cricket::FakeTransportController::OnDestroyRtcpTransport); |
| 151 channel2_->SignalDestroyRtcpTransport.connect( |
| 152 transport_controller2_.get(), |
| 153 &cricket::FakeTransportController::OnDestroyRtcpTransport); |
148 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 154 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
149 flags1 = (flags1 & ~SECURE); | 155 flags1 = (flags1 & ~SECURE); |
150 flags2 = (flags2 & ~SECURE); | 156 flags2 = (flags2 & ~SECURE); |
151 } | 157 } |
152 CreateContent(flags1, kPcmuCodec, kH264Codec, | 158 CreateContent(flags1, kPcmuCodec, kH264Codec, |
153 &local_media_content1_); | 159 &local_media_content1_); |
154 CreateContent(flags2, kPcmuCodec, kH264Codec, | 160 CreateContent(flags2, kPcmuCodec, kH264Codec, |
155 &local_media_content2_); | 161 &local_media_content2_); |
156 CopyContent(local_media_content1_, &remote_media_content1_); | 162 CopyContent(local_media_content1_, &remote_media_content1_); |
157 CopyContent(local_media_content2_, &remote_media_content2_); | 163 CopyContent(local_media_content2_, &remote_media_content2_); |
(...skipping 25 matching lines...) Expand all Loading... |
183 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); | 189 AddLegacyStreamInContent(kSsrc2, flags2, &remote_media_content2_); |
184 } | 190 } |
185 } | 191 } |
186 typename T::Channel* CreateChannel( | 192 typename T::Channel* CreateChannel( |
187 rtc::Thread* worker_thread, | 193 rtc::Thread* worker_thread, |
188 rtc::Thread* network_thread, | 194 rtc::Thread* network_thread, |
189 cricket::MediaEngineInterface* engine, | 195 cricket::MediaEngineInterface* engine, |
190 typename T::MediaChannel* ch, | 196 typename T::MediaChannel* ch, |
191 cricket::TransportController* transport_controller, | 197 cricket::TransportController* transport_controller, |
192 int flags) { | 198 int flags) { |
| 199 rtc::Thread* signaling_thread = |
| 200 transport_controller ? transport_controller->signaling_thread() |
| 201 : nullptr; |
193 typename T::Channel* channel = new typename T::Channel( | 202 typename T::Channel* channel = new typename T::Channel( |
194 worker_thread, network_thread, engine, ch, transport_controller, | 203 worker_thread, network_thread, signaling_thread, engine, ch, |
195 cricket::CN_AUDIO, (flags & RTCP) != 0, (flags & SECURE) != 0); | 204 cricket::CN_AUDIO, (flags & RTCP) != 0, (flags & SECURE) != 0); |
196 rtc::CryptoOptions crypto_options; | 205 rtc::CryptoOptions crypto_options; |
197 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 206 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
198 channel->SetCryptoOptions(crypto_options); | 207 channel->SetCryptoOptions(crypto_options); |
199 if (!channel->Init_w(nullptr)) { | 208 cricket::TransportChannel* rtp_transport = |
| 209 transport_controller->CreateTransportChannel( |
| 210 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 211 cricket::TransportChannel* rtcp_transport = nullptr; |
| 212 if (channel->NeedsRtcpTransport()) { |
| 213 rtcp_transport = transport_controller->CreateTransportChannel( |
| 214 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 215 } |
| 216 if (!channel->Init_w(rtp_transport, rtcp_transport)) { |
200 delete channel; | 217 delete channel; |
201 channel = NULL; | 218 channel = NULL; |
202 } | 219 } |
203 return channel; | 220 return channel; |
204 } | 221 } |
205 | 222 |
206 bool SendInitiate() { | 223 bool SendInitiate() { |
207 bool result = channel1_->SetLocalContent(&local_media_content1_, | 224 bool result = channel1_->SetLocalContent(&local_media_content1_, |
208 CA_OFFER, NULL); | 225 CA_OFFER, NULL); |
209 if (result) { | 226 if (result) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 bool CheckNoRtcp1() { | 393 bool CheckNoRtcp1() { |
377 return media_channel1_->CheckNoRtcp(); | 394 return media_channel1_->CheckNoRtcp(); |
378 } | 395 } |
379 bool CheckNoRtcp2() { | 396 bool CheckNoRtcp2() { |
380 return media_channel2_->CheckNoRtcp(); | 397 return media_channel2_->CheckNoRtcp(); |
381 } | 398 } |
382 // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. | 399 // Checks that the channel is using GCM iff GCM_CIPHER is set in flags. |
383 // Returns true if so. | 400 // Returns true if so. |
384 bool CheckGcmCipher(typename T::Channel* channel, int flags) { | 401 bool CheckGcmCipher(typename T::Channel* channel, int flags) { |
385 int suite; | 402 int suite; |
386 if (!channel->transport_channel()->GetSrtpCryptoSuite(&suite)) { | 403 if (!channel->rtp_transport()->GetSrtpCryptoSuite(&suite)) { |
387 return false; | 404 return false; |
388 } | 405 } |
389 | 406 |
390 if (flags & GCM_CIPHER) { | 407 if (flags & GCM_CIPHER) { |
391 return rtc::IsGcmCryptoSuite(suite); | 408 return rtc::IsGcmCryptoSuite(suite); |
392 } else { | 409 } else { |
393 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && | 410 return (suite != rtc::SRTP_INVALID_CRYPTO_SUITE && |
394 !rtc::IsGcmCryptoSuite(suite)); | 411 !rtc::IsGcmCryptoSuite(suite)); |
395 } | 412 } |
396 } | 413 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 523 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
507 ASSERT_EQ(1U, media_channel1_->codecs().size()); | 524 ASSERT_EQ(1U, media_channel1_->codecs().size()); |
508 EXPECT_TRUE(CodecMatches(content.codecs()[0], | 525 EXPECT_TRUE(CodecMatches(content.codecs()[0], |
509 media_channel1_->codecs()[0])); | 526 media_channel1_->codecs()[0])); |
510 } | 527 } |
511 | 528 |
512 // Test that SetLocalContent and SetRemoteContent properly set RTCP | 529 // Test that SetLocalContent and SetRemoteContent properly set RTCP |
513 // mux. | 530 // mux. |
514 void TestSetContentsRtcpMux() { | 531 void TestSetContentsRtcpMux() { |
515 CreateChannels(RTCP, RTCP); | 532 CreateChannels(RTCP, RTCP); |
516 EXPECT_TRUE(channel1_->rtcp_transport_channel() != NULL); | 533 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); |
517 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL); | 534 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); |
518 typename T::Content content; | 535 typename T::Content content; |
519 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 536 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
520 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 537 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
521 content.set_rtcp_mux(true); | 538 content.set_rtcp_mux(true); |
522 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 539 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
523 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 540 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
524 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 541 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); |
525 // Only initiator supports mux. Should still have a separate RTCP channel. | 542 // Only initiator supports mux. Should still have a separate RTCP channel. |
526 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); | 543 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); |
527 content.set_rtcp_mux(false); | 544 content.set_rtcp_mux(false); |
528 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 545 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
529 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL); | 546 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); |
530 } | 547 } |
531 | 548 |
532 // Test that SetLocalContent and SetRemoteContent properly set RTCP | 549 // Test that SetLocalContent and SetRemoteContent properly set RTCP |
533 // mux when a provisional answer is received. | 550 // mux when a provisional answer is received. |
534 void TestSetContentsRtcpMuxWithPrAnswer() { | 551 void TestSetContentsRtcpMuxWithPrAnswer() { |
535 CreateChannels(RTCP, RTCP); | 552 CreateChannels(RTCP, RTCP); |
536 EXPECT_TRUE(channel1_->rtcp_transport_channel() != NULL); | 553 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); |
537 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL); | 554 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); |
538 typename T::Content content; | 555 typename T::Content content; |
539 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 556 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
540 content.set_rtcp_mux(true); | 557 content.set_rtcp_mux(true); |
541 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 558 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
542 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL)); | 559 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_PRANSWER, NULL)); |
543 EXPECT_TRUE(channel1_->rtcp_transport_channel() != NULL); | 560 EXPECT_TRUE(channel1_->rtcp_transport() != NULL); |
544 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 561 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
545 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 562 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
546 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 563 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); |
547 // Only initiator supports mux. Should still have a separate RTCP channel. | 564 // Only initiator supports mux. Should still have a separate RTCP channel. |
548 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); | 565 EXPECT_TRUE(channel2_->SetLocalContent(&content, CA_OFFER, NULL)); |
549 content.set_rtcp_mux(false); | 566 content.set_rtcp_mux(false); |
550 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); | 567 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_PRANSWER, NULL)); |
551 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 568 EXPECT_TRUE(channel2_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
552 EXPECT_TRUE(channel2_->rtcp_transport_channel() != NULL); | 569 EXPECT_TRUE(channel2_->rtcp_transport() != NULL); |
553 } | 570 } |
554 | 571 |
555 // Test that SetRemoteContent properly deals with a content update. | 572 // Test that SetRemoteContent properly deals with a content update. |
556 void TestSetRemoteContentUpdate() { | 573 void TestSetRemoteContentUpdate() { |
557 CreateChannels(0, 0); | 574 CreateChannels(0, 0); |
558 typename T::Content content; | 575 typename T::Content content; |
559 CreateContent(RTCP | RTCP_MUX | SECURE, | 576 CreateContent(RTCP | RTCP_MUX | SECURE, |
560 kPcmuCodec, kH264Codec, | 577 kPcmuCodec, kH264Codec, |
561 &content); | 578 &content); |
562 EXPECT_EQ(0U, media_channel1_->codecs().size()); | 579 EXPECT_EQ(0U, media_channel1_->codecs().size()); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 | 941 |
925 // Tests that when the transport channel signals a candidate pair change | 942 // Tests that when the transport channel signals a candidate pair change |
926 // event, the media channel will receive a call on the network route change. | 943 // event, the media channel will receive a call on the network route change. |
927 void TestNetworkRouteChanges() { | 944 void TestNetworkRouteChanges() { |
928 constexpr uint16_t kLocalNetId = 1; | 945 constexpr uint16_t kLocalNetId = 1; |
929 constexpr uint16_t kRemoteNetId = 2; | 946 constexpr uint16_t kRemoteNetId = 2; |
930 constexpr int kLastPacketId = 100; | 947 constexpr int kLastPacketId = 100; |
931 | 948 |
932 CreateChannels(0, 0); | 949 CreateChannels(0, 0); |
933 | 950 |
934 cricket::TransportChannel* transport_channel1 = | 951 cricket::TransportChannel* transport_channel1 = channel1_->rtp_transport(); |
935 channel1_->transport_channel(); | |
936 ASSERT_TRUE(transport_channel1); | 952 ASSERT_TRUE(transport_channel1); |
937 typename T::MediaChannel* media_channel1 = | 953 typename T::MediaChannel* media_channel1 = |
938 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); | 954 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); |
939 ASSERT_TRUE(media_channel1); | 955 ASSERT_TRUE(media_channel1); |
940 | 956 |
941 media_channel1->set_num_network_route_changes(0); | 957 media_channel1->set_num_network_route_changes(0); |
942 network_thread_->Invoke<void>(RTC_FROM_HERE, [transport_channel1] { | 958 network_thread_->Invoke<void>(RTC_FROM_HERE, [transport_channel1] { |
943 // The transport channel becomes disconnected. | 959 // The transport channel becomes disconnected. |
944 transport_channel1->SignalSelectedCandidatePairChanged( | 960 transport_channel1->SignalSelectedCandidatePairChanged( |
945 transport_channel1, nullptr, -1, false); | 961 transport_channel1, nullptr, -1, false); |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 rtc::PacketOptions()); | 1813 rtc::PacketOptions()); |
1798 WaitForThreads(); | 1814 WaitForThreads(); |
1799 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1815 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
1800 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); | 1816 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); |
1801 | 1817 |
1802 // Testing failures in receiving packets. | 1818 // Testing failures in receiving packets. |
1803 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; | 1819 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; |
1804 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; | 1820 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; |
1805 | 1821 |
1806 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1822 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1807 cricket::TransportChannel* transport_channel = | 1823 cricket::TransportChannel* transport_channel = channel2_->rtp_transport(); |
1808 channel2_->transport_channel(); | |
1809 transport_channel->SignalReadPacket( | 1824 transport_channel->SignalReadPacket( |
1810 transport_channel, reinterpret_cast<const char*>(kBadPacket), | 1825 transport_channel, reinterpret_cast<const char*>(kBadPacket), |
1811 sizeof(kBadPacket), rtc::PacketTime(), 0); | 1826 sizeof(kBadPacket), rtc::PacketTime(), 0); |
1812 }); | 1827 }); |
1813 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1828 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
1814 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); | 1829 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); |
1815 // Terminate channels before the fake clock is destroyed. | 1830 // Terminate channels before the fake clock is destroyed. |
1816 EXPECT_TRUE(SendTerminate()); | 1831 EXPECT_TRUE(SendTerminate()); |
1817 } | 1832 } |
1818 | 1833 |
1819 void TestOnReadyToSend() { | 1834 void TestOnReadyToSend() { |
1820 CreateChannels(RTCP, RTCP); | 1835 CreateChannels(RTCP, RTCP); |
1821 TransportChannel* rtp = channel1_->transport_channel(); | 1836 TransportChannel* rtp = channel1_->rtp_transport(); |
1822 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); | 1837 TransportChannel* rtcp = channel1_->rtcp_transport(); |
1823 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1838 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1824 | 1839 |
1825 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1840 network_thread_->Invoke<void>(RTC_FROM_HERE, |
1826 [rtp] { rtp->SignalReadyToSend(rtp); }); | 1841 [rtp] { rtp->SignalReadyToSend(rtp); }); |
1827 WaitForThreads(); | 1842 WaitForThreads(); |
1828 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1843 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1829 | 1844 |
1830 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1845 network_thread_->Invoke<void>(RTC_FROM_HERE, |
1831 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); | 1846 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); |
1832 WaitForThreads(); | 1847 WaitForThreads(); |
(...skipping 29 matching lines...) Expand all Loading... |
1862 } | 1877 } |
1863 | 1878 |
1864 void TestOnReadyToSendWithRtcpMux() { | 1879 void TestOnReadyToSendWithRtcpMux() { |
1865 CreateChannels(RTCP, RTCP); | 1880 CreateChannels(RTCP, RTCP); |
1866 typename T::Content content; | 1881 typename T::Content content; |
1867 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1882 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1868 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1883 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
1869 content.set_rtcp_mux(true); | 1884 content.set_rtcp_mux(true); |
1870 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1885 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
1871 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1886 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
1872 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 1887 EXPECT_TRUE(channel1_->rtcp_transport() == NULL); |
1873 TransportChannel* rtp = channel1_->transport_channel(); | 1888 TransportChannel* rtp = channel1_->rtp_transport(); |
1874 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1889 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1875 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1890 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1876 // should trigger the MediaChannel's OnReadyToSend. | 1891 // should trigger the MediaChannel's OnReadyToSend. |
1877 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1892 network_thread_->Invoke<void>(RTC_FROM_HERE, |
1878 [rtp] { rtp->SignalReadyToSend(rtp); }); | 1893 [rtp] { rtp->SignalReadyToSend(rtp); }); |
1879 WaitForThreads(); | 1894 WaitForThreads(); |
1880 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1895 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1881 | 1896 |
1882 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { | 1897 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1883 channel1_->SetTransportChannelReadyToSend(false, false); | 1898 channel1_->SetTransportChannelReadyToSend(false, false); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 | 2049 |
2035 // override to add NULL parameter | 2050 // override to add NULL parameter |
2036 template <> | 2051 template <> |
2037 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 2052 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
2038 rtc::Thread* worker_thread, | 2053 rtc::Thread* worker_thread, |
2039 rtc::Thread* network_thread, | 2054 rtc::Thread* network_thread, |
2040 cricket::MediaEngineInterface* engine, | 2055 cricket::MediaEngineInterface* engine, |
2041 cricket::FakeVideoMediaChannel* ch, | 2056 cricket::FakeVideoMediaChannel* ch, |
2042 cricket::TransportController* transport_controller, | 2057 cricket::TransportController* transport_controller, |
2043 int flags) { | 2058 int flags) { |
| 2059 rtc::Thread* signaling_thread = |
| 2060 transport_controller ? transport_controller->signaling_thread() : nullptr; |
2044 cricket::VideoChannel* channel = new cricket::VideoChannel( | 2061 cricket::VideoChannel* channel = new cricket::VideoChannel( |
2045 worker_thread, network_thread, ch, transport_controller, | 2062 worker_thread, network_thread, signaling_thread, ch, cricket::CN_VIDEO, |
2046 cricket::CN_VIDEO, (flags & RTCP) != 0, (flags & SECURE) != 0); | 2063 (flags & RTCP) != 0, (flags & SECURE) != 0); |
2047 rtc::CryptoOptions crypto_options; | 2064 rtc::CryptoOptions crypto_options; |
2048 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 2065 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
2049 channel->SetCryptoOptions(crypto_options); | 2066 channel->SetCryptoOptions(crypto_options); |
2050 if (!channel->Init_w(nullptr)) { | 2067 cricket::TransportChannel* rtp_transport = |
| 2068 transport_controller->CreateTransportChannel( |
| 2069 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 2070 cricket::TransportChannel* rtcp_transport = nullptr; |
| 2071 if (channel->NeedsRtcpTransport()) { |
| 2072 rtcp_transport = transport_controller->CreateTransportChannel( |
| 2073 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 2074 } |
| 2075 if (!channel->Init_w(rtp_transport, rtcp_transport)) { |
2051 delete channel; | 2076 delete channel; |
2052 channel = NULL; | 2077 channel = NULL; |
2053 } | 2078 } |
2054 return channel; | 2079 return channel; |
2055 } | 2080 } |
2056 | 2081 |
2057 // override to add 0 parameter | 2082 // override to add 0 parameter |
2058 template<> | 2083 template<> |
2059 bool ChannelTest<VideoTraits>::AddStream1(int id) { | 2084 bool ChannelTest<VideoTraits>::AddStream1(int id) { |
2060 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 2085 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3306 | 3331 |
3307 // Override to avoid engine channel parameter. | 3332 // Override to avoid engine channel parameter. |
3308 template <> | 3333 template <> |
3309 cricket::RtpDataChannel* ChannelTest<DataTraits>::CreateChannel( | 3334 cricket::RtpDataChannel* ChannelTest<DataTraits>::CreateChannel( |
3310 rtc::Thread* worker_thread, | 3335 rtc::Thread* worker_thread, |
3311 rtc::Thread* network_thread, | 3336 rtc::Thread* network_thread, |
3312 cricket::MediaEngineInterface* engine, | 3337 cricket::MediaEngineInterface* engine, |
3313 cricket::FakeDataMediaChannel* ch, | 3338 cricket::FakeDataMediaChannel* ch, |
3314 cricket::TransportController* transport_controller, | 3339 cricket::TransportController* transport_controller, |
3315 int flags) { | 3340 int flags) { |
| 3341 rtc::Thread* signaling_thread = |
| 3342 transport_controller ? transport_controller->signaling_thread() : nullptr; |
3316 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel( | 3343 cricket::RtpDataChannel* channel = new cricket::RtpDataChannel( |
3317 worker_thread, network_thread, ch, transport_controller, cricket::CN_DATA, | 3344 worker_thread, network_thread, signaling_thread, ch, cricket::CN_DATA, |
3318 (flags & RTCP) != 0, (flags & SECURE) != 0); | 3345 (flags & RTCP) != 0, (flags & SECURE) != 0); |
3319 rtc::CryptoOptions crypto_options; | 3346 rtc::CryptoOptions crypto_options; |
3320 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; | 3347 crypto_options.enable_gcm_crypto_suites = (flags & GCM_CIPHER) != 0; |
3321 channel->SetCryptoOptions(crypto_options); | 3348 channel->SetCryptoOptions(crypto_options); |
3322 if (!channel->Init_w(nullptr)) { | 3349 cricket::TransportChannel* rtp_transport = |
| 3350 transport_controller->CreateTransportChannel( |
| 3351 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 3352 cricket::TransportChannel* rtcp_transport = nullptr; |
| 3353 if (channel->NeedsRtcpTransport()) { |
| 3354 rtcp_transport = transport_controller->CreateTransportChannel( |
| 3355 channel->content_name(), cricket::ICE_CANDIDATE_COMPONENT_RTCP); |
| 3356 } |
| 3357 if (!channel->Init_w(rtp_transport, rtcp_transport)) { |
3323 delete channel; | 3358 delete channel; |
3324 channel = NULL; | 3359 channel = NULL; |
3325 } | 3360 } |
3326 return channel; | 3361 return channel; |
3327 } | 3362 } |
3328 | 3363 |
3329 template <> | 3364 template <> |
3330 void ChannelTest<DataTraits>::CreateContent( | 3365 void ChannelTest<DataTraits>::CreateContent( |
3331 int flags, | 3366 int flags, |
3332 const cricket::AudioCodec& audio_codec, | 3367 const cricket::AudioCodec& audio_codec, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3647 }; | 3682 }; |
3648 rtc::CopyOnWriteBuffer payload(data, 3); | 3683 rtc::CopyOnWriteBuffer payload(data, 3); |
3649 cricket::SendDataResult result; | 3684 cricket::SendDataResult result; |
3650 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3685 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3651 EXPECT_EQ(params.ssrc, | 3686 EXPECT_EQ(params.ssrc, |
3652 media_channel1_->last_sent_data_params().ssrc); | 3687 media_channel1_->last_sent_data_params().ssrc); |
3653 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3688 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3654 } | 3689 } |
3655 | 3690 |
3656 // TODO(pthatcher): TestSetReceiver? | 3691 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |