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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 bool AddStream1(int id) { | 261 bool AddStream1(int id) { |
262 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); | 262 return channel1_->AddRecvStream(cricket::StreamParams::CreateLegacy(id)); |
263 } | 263 } |
264 bool RemoveStream1(int id) { | 264 bool RemoveStream1(int id) { |
265 return channel1_->RemoveRecvStream(id); | 265 return channel1_->RemoveRecvStream(id); |
266 } | 266 } |
267 | 267 |
268 cricket::FakeTransport* GetTransport1() { | 268 cricket::FakeTransport* GetTransport1() { |
269 std::string name = channel1_->content_name(); | 269 std::string name = channel1_->content_name(); |
270 return network_thread_->Invoke<cricket::FakeTransport*>( | 270 return network_thread_->Invoke<cricket::FakeTransport*>( |
| 271 RTC_FROM_HERE, |
271 [this, name] { return transport_controller1_->GetTransport_n(name); }); | 272 [this, name] { return transport_controller1_->GetTransport_n(name); }); |
272 } | 273 } |
273 cricket::FakeTransport* GetTransport2() { | 274 cricket::FakeTransport* GetTransport2() { |
274 std::string name = channel2_->content_name(); | 275 std::string name = channel2_->content_name(); |
275 return network_thread_->Invoke<cricket::FakeTransport*>( | 276 return network_thread_->Invoke<cricket::FakeTransport*>( |
| 277 RTC_FROM_HERE, |
276 [this, name] { return transport_controller2_->GetTransport_n(name); }); | 278 [this, name] { return transport_controller2_->GetTransport_n(name); }); |
277 } | 279 } |
278 | 280 |
279 void SendRtp1() { | 281 void SendRtp1() { |
280 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 282 media_channel1_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
281 rtc::PacketOptions()); | 283 rtc::PacketOptions()); |
282 } | 284 } |
283 void SendRtp2() { | 285 void SendRtp2() { |
284 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), | 286 media_channel2_->SendRtp(rtp_packet_.data(), rtp_packet_.size(), |
285 rtc::PacketOptions()); | 287 rtc::PacketOptions()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 395 |
394 // Will manage the lifetime of a CallThread, making sure it's | 396 // Will manage the lifetime of a CallThread, making sure it's |
395 // destroyed before this object goes out of scope. | 397 // destroyed before this object goes out of scope. |
396 class ScopedCallThread { | 398 class ScopedCallThread { |
397 public: | 399 public: |
398 template <class FunctorT> | 400 template <class FunctorT> |
399 ScopedCallThread(const FunctorT& functor) | 401 ScopedCallThread(const FunctorT& functor) |
400 : thread_(rtc::Thread::Create()), | 402 : thread_(rtc::Thread::Create()), |
401 task_(new rtc::FunctorMessageHandler<void, FunctorT>(functor)) { | 403 task_(new rtc::FunctorMessageHandler<void, FunctorT>(functor)) { |
402 thread_->Start(); | 404 thread_->Start(); |
403 thread_->Post(task_.get()); | 405 thread_->Post(RTC_FROM_HERE, task_.get()); |
404 } | 406 } |
405 | 407 |
406 ~ScopedCallThread() { thread_->Stop(); } | 408 ~ScopedCallThread() { thread_->Stop(); } |
407 | 409 |
408 rtc::Thread* thread() { return thread_.get(); } | 410 rtc::Thread* thread() { return thread_.get(); } |
409 | 411 |
410 private: | 412 private: |
411 std::unique_ptr<rtc::Thread> thread_; | 413 std::unique_ptr<rtc::Thread> thread_; |
412 std::unique_ptr<rtc::MessageHandler> task_; | 414 std::unique_ptr<rtc::MessageHandler> task_; |
413 }; | 415 }; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 CreateChannels(0, 0); | 906 CreateChannels(0, 0); |
905 | 907 |
906 cricket::TransportChannel* transport_channel1 = | 908 cricket::TransportChannel* transport_channel1 = |
907 channel1_->transport_channel(); | 909 channel1_->transport_channel(); |
908 ASSERT_TRUE(transport_channel1); | 910 ASSERT_TRUE(transport_channel1); |
909 typename T::MediaChannel* media_channel1 = | 911 typename T::MediaChannel* media_channel1 = |
910 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); | 912 static_cast<typename T::MediaChannel*>(channel1_->media_channel()); |
911 ASSERT_TRUE(media_channel1); | 913 ASSERT_TRUE(media_channel1); |
912 | 914 |
913 media_channel1->set_num_network_route_changes(0); | 915 media_channel1->set_num_network_route_changes(0); |
914 network_thread_->Invoke<void>([transport_channel1] { | 916 network_thread_->Invoke<void>(RTC_FROM_HERE, [transport_channel1] { |
915 // The transport channel becomes disconnected. | 917 // The transport channel becomes disconnected. |
916 transport_channel1->SignalSelectedCandidatePairChanged(transport_channel1, | 918 transport_channel1->SignalSelectedCandidatePairChanged(transport_channel1, |
917 nullptr, -1); | 919 nullptr, -1); |
918 }); | 920 }); |
919 WaitForThreads(); | 921 WaitForThreads(); |
920 EXPECT_EQ(1, media_channel1->num_network_route_changes()); | 922 EXPECT_EQ(1, media_channel1->num_network_route_changes()); |
921 EXPECT_FALSE(media_channel1->last_network_route().connected); | 923 EXPECT_FALSE(media_channel1->last_network_route().connected); |
922 media_channel1->set_num_network_route_changes(0); | 924 media_channel1->set_num_network_route_changes(0); |
923 | 925 |
924 network_thread_->Invoke<void>([this, transport_channel1, media_channel1, | 926 network_thread_->Invoke<void>(RTC_FROM_HERE, [this, transport_channel1, |
925 kLocalNetId, kRemoteNetId, kLastPacketId] { | 927 media_channel1, kLocalNetId, |
| 928 kRemoteNetId, kLastPacketId] { |
926 // The transport channel becomes connected. | 929 // The transport channel becomes connected. |
927 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); | 930 rtc::SocketAddress local_address("192.168.1.1", 1000 /* port number */); |
928 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); | 931 rtc::SocketAddress remote_address("192.168.1.2", 2000 /* port number */); |
929 std::unique_ptr<cricket::CandidatePairInterface> candidate_pair( | 932 std::unique_ptr<cricket::CandidatePairInterface> candidate_pair( |
930 transport_controller1_->CreateFakeCandidatePair( | 933 transport_controller1_->CreateFakeCandidatePair( |
931 local_address, kLocalNetId, remote_address, kRemoteNetId)); | 934 local_address, kLocalNetId, remote_address, kRemoteNetId)); |
932 transport_channel1->SignalSelectedCandidatePairChanged( | 935 transport_channel1->SignalSelectedCandidatePairChanged( |
933 transport_channel1, candidate_pair.get(), kLastPacketId); | 936 transport_channel1, candidate_pair.get(), kLastPacketId); |
934 }); | 937 }); |
935 WaitForThreads(); | 938 WaitForThreads(); |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 SendRtp1(); | 1451 SendRtp1(); |
1449 SendRtp2(); | 1452 SendRtp2(); |
1450 WaitForThreads(); | 1453 WaitForThreads(); |
1451 EXPECT_TRUE(CheckRtp1()); | 1454 EXPECT_TRUE(CheckRtp1()); |
1452 EXPECT_TRUE(CheckRtp2()); | 1455 EXPECT_TRUE(CheckRtp2()); |
1453 EXPECT_TRUE(CheckNoRtp1()); | 1456 EXPECT_TRUE(CheckNoRtp1()); |
1454 EXPECT_TRUE(CheckNoRtp2()); | 1457 EXPECT_TRUE(CheckNoRtp2()); |
1455 | 1458 |
1456 // Lose writability, which should fail. | 1459 // Lose writability, which should fail. |
1457 network_thread_->Invoke<void>( | 1460 network_thread_->Invoke<void>( |
1458 [this] { GetTransport1()->SetWritable(false); }); | 1461 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(false); }); |
1459 SendRtp1(); | 1462 SendRtp1(); |
1460 SendRtp2(); | 1463 SendRtp2(); |
1461 WaitForThreads(); | 1464 WaitForThreads(); |
1462 EXPECT_TRUE(CheckRtp1()); | 1465 EXPECT_TRUE(CheckRtp1()); |
1463 EXPECT_TRUE(CheckNoRtp2()); | 1466 EXPECT_TRUE(CheckNoRtp2()); |
1464 | 1467 |
1465 // Regain writability | 1468 // Regain writability |
1466 network_thread_->Invoke<void>( | 1469 network_thread_->Invoke<void>( |
1467 [this] { GetTransport1()->SetWritable(true); }); | 1470 RTC_FROM_HERE, [this] { GetTransport1()->SetWritable(true); }); |
1468 EXPECT_TRUE(media_channel1_->sending()); | 1471 EXPECT_TRUE(media_channel1_->sending()); |
1469 SendRtp1(); | 1472 SendRtp1(); |
1470 SendRtp2(); | 1473 SendRtp2(); |
1471 WaitForThreads(); | 1474 WaitForThreads(); |
1472 EXPECT_TRUE(CheckRtp1()); | 1475 EXPECT_TRUE(CheckRtp1()); |
1473 EXPECT_TRUE(CheckRtp2()); | 1476 EXPECT_TRUE(CheckRtp2()); |
1474 EXPECT_TRUE(CheckNoRtp1()); | 1477 EXPECT_TRUE(CheckNoRtp1()); |
1475 EXPECT_TRUE(CheckNoRtp2()); | 1478 EXPECT_TRUE(CheckNoRtp2()); |
1476 | 1479 |
1477 // Lose writability completely | 1480 // Lose writability completely |
1478 network_thread_->Invoke<void>( | 1481 network_thread_->Invoke<void>( |
1479 [this] { GetTransport1()->SetDestination(NULL); }); | 1482 RTC_FROM_HERE, [this] { GetTransport1()->SetDestination(NULL); }); |
1480 EXPECT_TRUE(media_channel1_->sending()); | 1483 EXPECT_TRUE(media_channel1_->sending()); |
1481 | 1484 |
1482 // Should fail also. | 1485 // Should fail also. |
1483 SendRtp1(); | 1486 SendRtp1(); |
1484 SendRtp2(); | 1487 SendRtp2(); |
1485 WaitForThreads(); | 1488 WaitForThreads(); |
1486 EXPECT_TRUE(CheckRtp1()); | 1489 EXPECT_TRUE(CheckRtp1()); |
1487 EXPECT_TRUE(CheckNoRtp2()); | 1490 EXPECT_TRUE(CheckNoRtp2()); |
1488 | 1491 |
1489 // Gain writability back | 1492 // Gain writability back |
1490 network_thread_->Invoke<void>( | 1493 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1491 [this] { GetTransport1()->SetDestination(GetTransport2()); }); | 1494 GetTransport1()->SetDestination(GetTransport2()); |
| 1495 }); |
1492 EXPECT_TRUE(media_channel1_->sending()); | 1496 EXPECT_TRUE(media_channel1_->sending()); |
1493 SendRtp1(); | 1497 SendRtp1(); |
1494 SendRtp2(); | 1498 SendRtp2(); |
1495 WaitForThreads(); | 1499 WaitForThreads(); |
1496 EXPECT_TRUE(CheckRtp1()); | 1500 EXPECT_TRUE(CheckRtp1()); |
1497 EXPECT_TRUE(CheckRtp2()); | 1501 EXPECT_TRUE(CheckRtp2()); |
1498 EXPECT_TRUE(CheckNoRtp1()); | 1502 EXPECT_TRUE(CheckNoRtp1()); |
1499 EXPECT_TRUE(CheckNoRtp2()); | 1503 EXPECT_TRUE(CheckNoRtp2()); |
1500 } | 1504 } |
1501 | 1505 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket), | 1785 media_channel2_->SendRtp(kBadPacket, sizeof(kBadPacket), |
1782 rtc::PacketOptions()); | 1786 rtc::PacketOptions()); |
1783 WaitForThreads(); | 1787 WaitForThreads(); |
1784 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1788 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
1785 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); | 1789 EXPECT_EQ(cricket::SrtpFilter::PROTECT, error_handler.mode_); |
1786 | 1790 |
1787 // Testing failures in receiving packets. | 1791 // Testing failures in receiving packets. |
1788 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; | 1792 error_handler.error_ = cricket::SrtpFilter::ERROR_NONE; |
1789 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; | 1793 error_handler.mode_ = cricket::SrtpFilter::UNPROTECT; |
1790 | 1794 |
1791 network_thread_->Invoke<void>([this] { | 1795 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1792 cricket::TransportChannel* transport_channel = | 1796 cricket::TransportChannel* transport_channel = |
1793 channel2_->transport_channel(); | 1797 channel2_->transport_channel(); |
1794 transport_channel->SignalReadPacket( | 1798 transport_channel->SignalReadPacket( |
1795 transport_channel, reinterpret_cast<const char*>(kBadPacket), | 1799 transport_channel, reinterpret_cast<const char*>(kBadPacket), |
1796 sizeof(kBadPacket), rtc::PacketTime(), 0); | 1800 sizeof(kBadPacket), rtc::PacketTime(), 0); |
1797 }); | 1801 }); |
1798 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); | 1802 EXPECT_EQ(cricket::SrtpFilter::ERROR_FAIL, error_handler.error_); |
1799 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); | 1803 EXPECT_EQ(cricket::SrtpFilter::UNPROTECT, error_handler.mode_); |
1800 } | 1804 } |
1801 | 1805 |
1802 void TestOnReadyToSend() { | 1806 void TestOnReadyToSend() { |
1803 CreateChannels(RTCP, RTCP); | 1807 CreateChannels(RTCP, RTCP); |
1804 TransportChannel* rtp = channel1_->transport_channel(); | 1808 TransportChannel* rtp = channel1_->transport_channel(); |
1805 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); | 1809 TransportChannel* rtcp = channel1_->rtcp_transport_channel(); |
1806 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1810 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1807 | 1811 |
1808 network_thread_->Invoke<void>([rtp] { rtp->SignalReadyToSend(rtp); }); | 1812 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1813 [rtp] { rtp->SignalReadyToSend(rtp); }); |
1809 WaitForThreads(); | 1814 WaitForThreads(); |
1810 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1815 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1811 | 1816 |
1812 network_thread_->Invoke<void>([rtcp] { rtcp->SignalReadyToSend(rtcp); }); | 1817 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1818 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); |
1813 WaitForThreads(); | 1819 WaitForThreads(); |
1814 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp | 1820 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp |
1815 // channel are ready to send. | 1821 // channel are ready to send. |
1816 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1822 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1817 | 1823 |
1818 // rtp channel becomes not ready to send will be propagated to mediachannel | 1824 // rtp channel becomes not ready to send will be propagated to mediachannel |
1819 network_thread_->Invoke<void>( | 1825 network_thread_->Invoke<void>( |
1820 [this] { channel1_->SetReadyToSend(false, false); }); | 1826 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, false); }); |
1821 WaitForThreads(); | 1827 WaitForThreads(); |
1822 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1828 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1823 | 1829 |
1824 network_thread_->Invoke<void>( | 1830 network_thread_->Invoke<void>( |
1825 [this] { channel1_->SetReadyToSend(false, true); }); | 1831 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, true); }); |
1826 WaitForThreads(); | 1832 WaitForThreads(); |
1827 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1833 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1828 | 1834 |
1829 // rtcp channel becomes not ready to send will be propagated to mediachannel | 1835 // rtcp channel becomes not ready to send will be propagated to mediachannel |
1830 network_thread_->Invoke<void>( | 1836 network_thread_->Invoke<void>( |
1831 [this] { channel1_->SetReadyToSend(true, false); }); | 1837 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(true, false); }); |
1832 WaitForThreads(); | 1838 WaitForThreads(); |
1833 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1839 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1834 | 1840 |
1835 network_thread_->Invoke<void>( | 1841 network_thread_->Invoke<void>( |
1836 [this] { channel1_->SetReadyToSend(true, true); }); | 1842 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(true, true); }); |
1837 WaitForThreads(); | 1843 WaitForThreads(); |
1838 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1844 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1839 } | 1845 } |
1840 | 1846 |
1841 void TestOnReadyToSendWithRtcpMux() { | 1847 void TestOnReadyToSendWithRtcpMux() { |
1842 CreateChannels(RTCP, RTCP); | 1848 CreateChannels(RTCP, RTCP); |
1843 typename T::Content content; | 1849 typename T::Content content; |
1844 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1850 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1845 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1851 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
1846 content.set_rtcp_mux(true); | 1852 content.set_rtcp_mux(true); |
1847 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1853 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
1848 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1854 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
1849 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 1855 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); |
1850 TransportChannel* rtp = channel1_->transport_channel(); | 1856 TransportChannel* rtp = channel1_->transport_channel(); |
1851 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1857 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1852 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1858 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1853 // should trigger the MediaChannel's OnReadyToSend. | 1859 // should trigger the MediaChannel's OnReadyToSend. |
1854 network_thread_->Invoke<void>([rtp] { rtp->SignalReadyToSend(rtp); }); | 1860 network_thread_->Invoke<void>(RTC_FROM_HERE, |
| 1861 [rtp] { rtp->SignalReadyToSend(rtp); }); |
1855 WaitForThreads(); | 1862 WaitForThreads(); |
1856 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1863 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1857 | 1864 |
1858 network_thread_->Invoke<void>( | 1865 network_thread_->Invoke<void>( |
1859 [this] { channel1_->SetReadyToSend(false, false); }); | 1866 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, false); }); |
1860 WaitForThreads(); | 1867 WaitForThreads(); |
1861 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1868 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1862 } | 1869 } |
1863 | 1870 |
1864 bool SetRemoteContentWithBitrateLimit(int remote_limit) { | 1871 bool SetRemoteContentWithBitrateLimit(int remote_limit) { |
1865 typename T::Content content; | 1872 typename T::Content content; |
1866 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1873 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1867 content.set_bandwidth(remote_limit); | 1874 content.set_bandwidth(remote_limit); |
1868 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); | 1875 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); |
1869 } | 1876 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 void WaitForThreads() { WaitForThreads(rtc::ArrayView<rtc::Thread*>()); } | 1919 void WaitForThreads() { WaitForThreads(rtc::ArrayView<rtc::Thread*>()); } |
1913 static void ProcessThreadQueue(rtc::Thread* thread) { | 1920 static void ProcessThreadQueue(rtc::Thread* thread) { |
1914 RTC_DCHECK(thread->IsCurrent()); | 1921 RTC_DCHECK(thread->IsCurrent()); |
1915 while (!thread->empty()) { | 1922 while (!thread->empty()) { |
1916 thread->ProcessMessages(0); | 1923 thread->ProcessMessages(0); |
1917 } | 1924 } |
1918 } | 1925 } |
1919 void WaitForThreads(rtc::ArrayView<rtc::Thread*> threads) { | 1926 void WaitForThreads(rtc::ArrayView<rtc::Thread*> threads) { |
1920 // |threads| and current thread post packets to network thread. | 1927 // |threads| and current thread post packets to network thread. |
1921 for (rtc::Thread* thread : threads) { | 1928 for (rtc::Thread* thread : threads) { |
1922 thread->Invoke<void>([thread] { ProcessThreadQueue(thread); }); | 1929 thread->Invoke<void>(RTC_FROM_HERE, |
| 1930 [thread] { ProcessThreadQueue(thread); }); |
1923 } | 1931 } |
1924 ProcessThreadQueue(rtc::Thread::Current()); | 1932 ProcessThreadQueue(rtc::Thread::Current()); |
1925 // Network thread move them around and post back to worker = current thread. | 1933 // Network thread move them around and post back to worker = current thread. |
1926 if (!network_thread_->IsCurrent()) { | 1934 if (!network_thread_->IsCurrent()) { |
1927 network_thread_->Invoke<void>( | 1935 network_thread_->Invoke<void>( |
1928 [this] { ProcessThreadQueue(network_thread_); }); | 1936 RTC_FROM_HERE, [this] { ProcessThreadQueue(network_thread_); }); |
1929 } | 1937 } |
1930 // Worker thread = current Thread process received messages. | 1938 // Worker thread = current Thread process received messages. |
1931 ProcessThreadQueue(rtc::Thread::Current()); | 1939 ProcessThreadQueue(rtc::Thread::Current()); |
1932 } | 1940 } |
1933 // TODO(pbos): Remove playout from all media channels and let renderers mute | 1941 // TODO(pbos): Remove playout from all media channels and let renderers mute |
1934 // themselves. | 1942 // themselves. |
1935 const bool verify_playout_; | 1943 const bool verify_playout_; |
1936 std::unique_ptr<rtc::Thread> network_thread_keeper_; | 1944 std::unique_ptr<rtc::Thread> network_thread_keeper_; |
1937 rtc::Thread* network_thread_; | 1945 rtc::Thread* network_thread_; |
1938 std::unique_ptr<cricket::FakeTransportController> transport_controller1_; | 1946 std::unique_ptr<cricket::FakeTransportController> transport_controller1_; |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3586 }; | 3594 }; |
3587 rtc::CopyOnWriteBuffer payload(data, 3); | 3595 rtc::CopyOnWriteBuffer payload(data, 3); |
3588 cricket::SendDataResult result; | 3596 cricket::SendDataResult result; |
3589 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3597 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3590 EXPECT_EQ(params.ssrc, | 3598 EXPECT_EQ(params.ssrc, |
3591 media_channel1_->last_sent_data_params().ssrc); | 3599 media_channel1_->last_sent_data_params().ssrc); |
3592 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3600 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3593 } | 3601 } |
3594 | 3602 |
3595 // TODO(pthatcher): TestSetReceiver? | 3603 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |