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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1855 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1856 | 1856 |
1857 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1857 network_thread_->Invoke<void>(RTC_FROM_HERE, |
1858 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); | 1858 [rtcp] { rtcp->SignalReadyToSend(rtcp); }); |
1859 WaitForThreads(); | 1859 WaitForThreads(); |
1860 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp | 1860 // MediaChannel::OnReadyToSend only be called when both rtp and rtcp |
1861 // channel are ready to send. | 1861 // channel are ready to send. |
1862 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1862 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1863 | 1863 |
1864 // rtp channel becomes not ready to send will be propagated to mediachannel | 1864 // rtp channel becomes not ready to send will be propagated to mediachannel |
1865 network_thread_->Invoke<void>( | 1865 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1866 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, false); }); | 1866 channel1_->SetTransportChannelReadyToSend(false, false); |
| 1867 }); |
1867 WaitForThreads(); | 1868 WaitForThreads(); |
1868 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1869 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1869 | 1870 |
1870 network_thread_->Invoke<void>( | 1871 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1871 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, true); }); | 1872 channel1_->SetTransportChannelReadyToSend(false, true); |
| 1873 }); |
1872 WaitForThreads(); | 1874 WaitForThreads(); |
1873 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1875 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1874 | 1876 |
1875 // rtcp channel becomes not ready to send will be propagated to mediachannel | 1877 // rtcp channel becomes not ready to send will be propagated to mediachannel |
1876 network_thread_->Invoke<void>( | 1878 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1877 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(true, false); }); | 1879 channel1_->SetTransportChannelReadyToSend(true, false); |
| 1880 }); |
1878 WaitForThreads(); | 1881 WaitForThreads(); |
1879 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1882 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1880 | 1883 |
1881 network_thread_->Invoke<void>( | 1884 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1882 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(true, true); }); | 1885 channel1_->SetTransportChannelReadyToSend(true, true); |
| 1886 }); |
1883 WaitForThreads(); | 1887 WaitForThreads(); |
1884 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1888 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1885 } | 1889 } |
1886 | 1890 |
1887 void TestOnReadyToSendWithRtcpMux() { | 1891 void TestOnReadyToSendWithRtcpMux() { |
1888 CreateChannels(RTCP, RTCP); | 1892 CreateChannels(RTCP, RTCP); |
1889 typename T::Content content; | 1893 typename T::Content content; |
1890 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1894 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1891 // Both sides agree on mux. Should no longer be a separate RTCP channel. | 1895 // Both sides agree on mux. Should no longer be a separate RTCP channel. |
1892 content.set_rtcp_mux(true); | 1896 content.set_rtcp_mux(true); |
1893 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); | 1897 EXPECT_TRUE(channel1_->SetLocalContent(&content, CA_OFFER, NULL)); |
1894 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); | 1898 EXPECT_TRUE(channel1_->SetRemoteContent(&content, CA_ANSWER, NULL)); |
1895 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); | 1899 EXPECT_TRUE(channel1_->rtcp_transport_channel() == NULL); |
1896 TransportChannel* rtp = channel1_->transport_channel(); | 1900 TransportChannel* rtp = channel1_->transport_channel(); |
1897 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1901 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1898 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel | 1902 // In the case of rtcp mux, the SignalReadyToSend() from rtp channel |
1899 // should trigger the MediaChannel's OnReadyToSend. | 1903 // should trigger the MediaChannel's OnReadyToSend. |
1900 network_thread_->Invoke<void>(RTC_FROM_HERE, | 1904 network_thread_->Invoke<void>(RTC_FROM_HERE, |
1901 [rtp] { rtp->SignalReadyToSend(rtp); }); | 1905 [rtp] { rtp->SignalReadyToSend(rtp); }); |
1902 WaitForThreads(); | 1906 WaitForThreads(); |
1903 EXPECT_TRUE(media_channel1_->ready_to_send()); | 1907 EXPECT_TRUE(media_channel1_->ready_to_send()); |
1904 | 1908 |
1905 network_thread_->Invoke<void>( | 1909 network_thread_->Invoke<void>(RTC_FROM_HERE, [this] { |
1906 RTC_FROM_HERE, [this] { channel1_->SetReadyToSend(false, false); }); | 1910 channel1_->SetTransportChannelReadyToSend(false, false); |
| 1911 }); |
1907 WaitForThreads(); | 1912 WaitForThreads(); |
1908 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1913 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1909 } | 1914 } |
1910 | 1915 |
1911 bool SetRemoteContentWithBitrateLimit(int remote_limit) { | 1916 bool SetRemoteContentWithBitrateLimit(int remote_limit) { |
1912 typename T::Content content; | 1917 typename T::Content content; |
1913 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1918 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1914 content.set_bandwidth(remote_limit); | 1919 content.set_bandwidth(remote_limit); |
1915 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); | 1920 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); |
1916 } | 1921 } |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3672 }; | 3677 }; |
3673 rtc::CopyOnWriteBuffer payload(data, 3); | 3678 rtc::CopyOnWriteBuffer payload(data, 3); |
3674 cricket::SendDataResult result; | 3679 cricket::SendDataResult result; |
3675 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3680 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3676 EXPECT_EQ(params.ssrc, | 3681 EXPECT_EQ(params.ssrc, |
3677 media_channel1_->last_sent_data_params().ssrc); | 3682 media_channel1_->last_sent_data_params().ssrc); |
3678 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3683 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3679 } | 3684 } |
3680 | 3685 |
3681 // TODO(pthatcher): TestSetReceiver? | 3686 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |