Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2009 Google Inc. | 3 * Copyright 2009 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session2_, | 174 channel2_.reset(CreateChannel(thread, &media_engine_, ch2, &session2_, |
| 175 (flags2 & RTCP) != 0)); | 175 (flags2 & RTCP) != 0)); |
| 176 channel1_->SignalMediaMonitor.connect( | 176 channel1_->SignalMediaMonitor.connect( |
| 177 this, &ChannelTest<T>::OnMediaMonitor); | 177 this, &ChannelTest<T>::OnMediaMonitor); |
| 178 channel2_->SignalMediaMonitor.connect( | 178 channel2_->SignalMediaMonitor.connect( |
| 179 this, &ChannelTest<T>::OnMediaMonitor); | 179 this, &ChannelTest<T>::OnMediaMonitor); |
| 180 channel1_->SignalMediaError.connect( | 180 channel1_->SignalMediaError.connect( |
| 181 this, &ChannelTest<T>::OnMediaChannelError); | 181 this, &ChannelTest<T>::OnMediaChannelError); |
| 182 channel2_->SignalMediaError.connect( | 182 channel2_->SignalMediaError.connect( |
| 183 this, &ChannelTest<T>::OnMediaChannelError); | 183 this, &ChannelTest<T>::OnMediaChannelError); |
| 184 channel1_->SignalAutoMuted.connect( | 184 // TODO(solenberg): !!!! |
| 185 this, &ChannelTest<T>::OnMediaMuted); | 185 // channel1_->SignalAutoMuted.connect( |
| 186 // this, &ChannelTest<T>::OnMediaMuted); | |
|
pthatcher1
2015/09/04 23:21:16
This is only used by TypingMonitor, which isn't us
the sun
2015/09/08 11:31:12
Pooff: https://codereview.chromium.org/1327033002/
| |
| 186 if ((flags1 & DTLS) && (flags2 & DTLS)) { | 187 if ((flags1 & DTLS) && (flags2 & DTLS)) { |
| 187 flags1 = (flags1 & ~SECURE); | 188 flags1 = (flags1 & ~SECURE); |
| 188 flags2 = (flags2 & ~SECURE); | 189 flags2 = (flags2 & ~SECURE); |
| 189 } | 190 } |
| 190 CreateContent(flags1, kPcmuCodec, kH264Codec, | 191 CreateContent(flags1, kPcmuCodec, kH264Codec, |
| 191 &local_media_content1_); | 192 &local_media_content1_); |
| 192 CreateContent(flags2, kPcmuCodec, kH264Codec, | 193 CreateContent(flags2, kPcmuCodec, kH264Codec, |
| 193 &local_media_content2_); | 194 &local_media_content2_); |
| 194 CopyContent(local_media_content1_, &remote_media_content1_); | 195 CopyContent(local_media_content1_, &remote_media_content1_); |
| 195 CopyContent(local_media_content2_, &remote_media_content2_); | 196 CopyContent(local_media_content2_, &remote_media_content2_); |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 CA_ANSWER, NULL)); | 903 CA_ANSWER, NULL)); |
| 903 EXPECT_TRUE(media_channel1_->playout()); | 904 EXPECT_TRUE(media_channel1_->playout()); |
| 904 EXPECT_TRUE(media_channel1_->sending()); | 905 EXPECT_TRUE(media_channel1_->sending()); |
| 905 } | 906 } |
| 906 | 907 |
| 907 void TestMuteStream() { | 908 void TestMuteStream() { |
| 908 CreateChannels(0, 0); | 909 CreateChannels(0, 0); |
| 909 // Test that we can Mute the default channel even though the sending SSRC is | 910 // Test that we can Mute the default channel even though the sending SSRC is |
| 910 // unknown. | 911 // unknown. |
| 911 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 912 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 912 EXPECT_TRUE(channel1_->MuteStream(0, true)); | 913 EXPECT_TRUE(channel1_->MuteStream(0, true, nullptr)); |
| 913 EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); | 914 EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); |
| 914 EXPECT_TRUE(channel1_->MuteStream(0, false)); | 915 EXPECT_TRUE(channel1_->MuteStream(0, false, nullptr)); |
| 915 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 916 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 916 | 917 |
| 917 // Test that we can not mute an unknown SSRC. | 918 // Test that we can not mute an unknown SSRC. |
| 918 EXPECT_FALSE(channel1_->MuteStream(kSsrc1, true)); | 919 EXPECT_FALSE(channel1_->MuteStream(kSsrc1, true, nullptr)); |
| 919 | 920 |
| 920 SendInitiate(); | 921 SendInitiate(); |
| 921 // After the local session description has been set, we can mute a stream | 922 // After the local session description has been set, we can mute a stream |
| 922 // with its SSRC. | 923 // with its SSRC. |
| 923 EXPECT_TRUE(channel1_->MuteStream(kSsrc1, true)); | 924 EXPECT_TRUE(channel1_->MuteStream(kSsrc1, true, nullptr)); |
| 924 EXPECT_TRUE(media_channel1_->IsStreamMuted(kSsrc1)); | 925 EXPECT_TRUE(media_channel1_->IsStreamMuted(kSsrc1)); |
| 925 EXPECT_TRUE(channel1_->MuteStream(kSsrc1, false)); | 926 EXPECT_TRUE(channel1_->MuteStream(kSsrc1, false, nullptr)); |
| 926 EXPECT_FALSE(media_channel1_->IsStreamMuted(kSsrc1)); | 927 EXPECT_FALSE(media_channel1_->IsStreamMuted(kSsrc1)); |
| 927 } | 928 } |
| 928 | 929 |
| 929 // Test that changing the MediaContentDirection in the local and remote | 930 // Test that changing the MediaContentDirection in the local and remote |
| 930 // session description start playout and sending at the right time. | 931 // session description start playout and sending at the right time. |
| 931 void TestMediaContentDirection() { | 932 void TestMediaContentDirection() { |
| 932 CreateChannels(0, 0); | 933 CreateChannels(0, 0); |
| 933 typename T::Content content1; | 934 typename T::Content content1; |
| 934 CreateContent(0, kPcmuCodec, kH264Codec, &content1); | 935 CreateContent(0, kPcmuCodec, kH264Codec, &content1); |
| 935 typename T::Content content2; | 936 typename T::Content content2; |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1842 } | 1843 } |
| 1843 | 1844 |
| 1844 class VoiceChannelTest | 1845 class VoiceChannelTest |
| 1845 : public ChannelTest<VoiceTraits> { | 1846 : public ChannelTest<VoiceTraits> { |
| 1846 public: | 1847 public: |
| 1847 typedef ChannelTest<VoiceTraits> | 1848 typedef ChannelTest<VoiceTraits> |
| 1848 Base; | 1849 Base; |
| 1849 VoiceChannelTest() : Base(kPcmuFrame, sizeof(kPcmuFrame), | 1850 VoiceChannelTest() : Base(kPcmuFrame, sizeof(kPcmuFrame), |
| 1850 kRtcpReport, sizeof(kRtcpReport)) { | 1851 kRtcpReport, sizeof(kRtcpReport)) { |
| 1851 } | 1852 } |
| 1852 | |
| 1853 void TestSetChannelOptions() { | |
| 1854 CreateChannels(0, 0); | |
| 1855 | |
| 1856 cricket::AudioOptions options1; | |
| 1857 options1.echo_cancellation.Set(false); | |
| 1858 cricket::AudioOptions options2; | |
| 1859 options2.echo_cancellation.Set(true); | |
| 1860 | |
| 1861 channel1_->SetChannelOptions(options1); | |
| 1862 channel2_->SetChannelOptions(options1); | |
| 1863 cricket::AudioOptions actual_options; | |
| 1864 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options)); | |
| 1865 EXPECT_EQ(options1, actual_options); | |
| 1866 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options)); | |
| 1867 EXPECT_EQ(options1, actual_options); | |
| 1868 | |
| 1869 channel1_->SetChannelOptions(options2); | |
| 1870 channel2_->SetChannelOptions(options2); | |
| 1871 ASSERT_TRUE(media_channel1_->GetOptions(&actual_options)); | |
| 1872 EXPECT_EQ(options2, actual_options); | |
| 1873 ASSERT_TRUE(media_channel2_->GetOptions(&actual_options)); | |
| 1874 EXPECT_EQ(options2, actual_options); | |
| 1875 } | |
| 1876 }; | 1853 }; |
| 1877 | 1854 |
| 1878 // override to add NULL parameter | 1855 // override to add NULL parameter |
| 1879 template<> | 1856 template<> |
| 1880 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( | 1857 cricket::VideoChannel* ChannelTest<VideoTraits>::CreateChannel( |
| 1881 rtc::Thread* thread, cricket::MediaEngineInterface* engine, | 1858 rtc::Thread* thread, cricket::MediaEngineInterface* engine, |
| 1882 cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session, | 1859 cricket::FakeVideoMediaChannel* ch, cricket::BaseSession* session, |
| 1883 bool rtcp) { | 1860 bool rtcp) { |
| 1884 cricket::VideoChannel* channel = new cricket::VideoChannel( | 1861 cricket::VideoChannel* channel = new cricket::VideoChannel( |
| 1885 thread, ch, session, cricket::CN_VIDEO, rtcp); | 1862 thread, ch, session, cricket::CN_VIDEO, rtcp); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1932 } | 1909 } |
| 1933 | 1910 |
| 1934 class VideoChannelTest | 1911 class VideoChannelTest |
| 1935 : public ChannelTest<VideoTraits> { | 1912 : public ChannelTest<VideoTraits> { |
| 1936 public: | 1913 public: |
| 1937 typedef ChannelTest<VideoTraits> | 1914 typedef ChannelTest<VideoTraits> |
| 1938 Base; | 1915 Base; |
| 1939 VideoChannelTest() : Base(kH264Packet, sizeof(kH264Packet), | 1916 VideoChannelTest() : Base(kH264Packet, sizeof(kH264Packet), |
| 1940 kRtcpReport, sizeof(kRtcpReport)) { | 1917 kRtcpReport, sizeof(kRtcpReport)) { |
| 1941 } | 1918 } |
| 1942 | |
| 1943 void TestSetChannelOptions() { | |
| 1944 CreateChannels(0, 0); | |
| 1945 | |
| 1946 cricket::VideoOptions o1, o2; | |
| 1947 o1.video_noise_reduction.Set(true); | |
| 1948 | |
| 1949 channel1_->SetChannelOptions(o1); | |
| 1950 channel2_->SetChannelOptions(o1); | |
| 1951 EXPECT_TRUE(media_channel1_->GetOptions(&o2)); | |
| 1952 EXPECT_EQ(o1, o2); | |
| 1953 EXPECT_TRUE(media_channel2_->GetOptions(&o2)); | |
| 1954 EXPECT_EQ(o1, o2); | |
| 1955 | |
| 1956 o1.video_start_bitrate.Set(123); | |
| 1957 channel1_->SetChannelOptions(o1); | |
| 1958 channel2_->SetChannelOptions(o1); | |
| 1959 EXPECT_TRUE(media_channel1_->GetOptions(&o2)); | |
| 1960 EXPECT_EQ(o1, o2); | |
| 1961 EXPECT_TRUE(media_channel2_->GetOptions(&o2)); | |
| 1962 EXPECT_EQ(o1, o2); | |
| 1963 } | |
| 1964 }; | 1919 }; |
| 1965 | 1920 |
| 1966 | 1921 |
| 1967 // VoiceChannelTest | 1922 // VoiceChannelTest |
| 1968 | 1923 |
| 1969 TEST_F(VoiceChannelTest, TestInit) { | 1924 TEST_F(VoiceChannelTest, TestInit) { |
| 1970 Base::TestInit(); | 1925 Base::TestInit(); |
| 1971 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 1926 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 1972 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); | 1927 EXPECT_TRUE(media_channel1_->dtmf_info_queue().empty()); |
| 1973 } | 1928 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2126 TEST_F(VoiceChannelTest, TestMediaMonitor) { | 2081 TEST_F(VoiceChannelTest, TestMediaMonitor) { |
| 2127 Base::TestMediaMonitor(); | 2082 Base::TestMediaMonitor(); |
| 2128 } | 2083 } |
| 2129 | 2084 |
| 2130 // Test that MuteStream properly forwards to the media channel and does | 2085 // Test that MuteStream properly forwards to the media channel and does |
| 2131 // not signal. | 2086 // not signal. |
| 2132 TEST_F(VoiceChannelTest, TestVoiceSpecificMuteStream) { | 2087 TEST_F(VoiceChannelTest, TestVoiceSpecificMuteStream) { |
| 2133 CreateChannels(0, 0); | 2088 CreateChannels(0, 0); |
| 2134 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 2089 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 2135 EXPECT_FALSE(mute_callback_recved_); | 2090 EXPECT_FALSE(mute_callback_recved_); |
| 2136 EXPECT_TRUE(channel1_->MuteStream(0, true)); | 2091 EXPECT_TRUE(channel1_->MuteStream(0, true, nullptr)); |
| 2137 EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); | 2092 EXPECT_TRUE(media_channel1_->IsStreamMuted(0)); |
| 2138 EXPECT_FALSE(mute_callback_recved_); | 2093 EXPECT_FALSE(mute_callback_recved_); |
| 2139 EXPECT_TRUE(channel1_->MuteStream(0, false)); | 2094 EXPECT_TRUE(channel1_->MuteStream(0, false, nullptr)); |
| 2140 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 2095 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 2141 EXPECT_FALSE(mute_callback_recved_); | 2096 EXPECT_FALSE(mute_callback_recved_); |
| 2142 } | 2097 } |
| 2143 | 2098 |
| 2144 // Test that keyboard automute works correctly and signals upwards. | 2099 // Test that keyboard automute works correctly and signals upwards. |
| 2145 TEST_F(VoiceChannelTest, DISABLED_TestKeyboardMute) { | 2100 TEST_F(VoiceChannelTest, DISABLED_TestKeyboardMute) { |
| 2146 CreateChannels(0, 0); | 2101 CreateChannels(0, 0); |
| 2147 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); | 2102 EXPECT_FALSE(media_channel1_->IsStreamMuted(0)); |
| 2148 EXPECT_EQ(cricket::VoiceMediaChannel::ERROR_NONE, error_); | 2103 EXPECT_EQ(cricket::VoiceMediaChannel::ERROR_NONE, error_); |
| 2149 | 2104 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2356 TEST_F(VoiceChannelTest, SendBundleToBundleWithRtcpMux) { | 2311 TEST_F(VoiceChannelTest, SendBundleToBundleWithRtcpMux) { |
| 2357 Base::SendBundleToBundle( | 2312 Base::SendBundleToBundle( |
| 2358 kAudioPts, ARRAY_SIZE(kAudioPts), true, false); | 2313 kAudioPts, ARRAY_SIZE(kAudioPts), true, false); |
| 2359 } | 2314 } |
| 2360 | 2315 |
| 2361 TEST_F(VoiceChannelTest, SendBundleToBundleWithRtcpMuxSecure) { | 2316 TEST_F(VoiceChannelTest, SendBundleToBundleWithRtcpMuxSecure) { |
| 2362 Base::SendBundleToBundle( | 2317 Base::SendBundleToBundle( |
| 2363 kAudioPts, ARRAY_SIZE(kAudioPts), true, true); | 2318 kAudioPts, ARRAY_SIZE(kAudioPts), true, true); |
| 2364 } | 2319 } |
| 2365 | 2320 |
| 2366 TEST_F(VoiceChannelTest, TestSetChannelOptions) { | |
| 2367 TestSetChannelOptions(); | |
| 2368 } | |
| 2369 | |
| 2370 // VideoChannelTest | 2321 // VideoChannelTest |
| 2371 TEST_F(VideoChannelTest, TestInit) { | 2322 TEST_F(VideoChannelTest, TestInit) { |
| 2372 Base::TestInit(); | 2323 Base::TestInit(); |
| 2373 } | 2324 } |
| 2374 | 2325 |
| 2375 TEST_F(VideoChannelTest, TestSetContents) { | 2326 TEST_F(VideoChannelTest, TestSetContents) { |
| 2376 Base::TestSetContents(); | 2327 Base::TestSetContents(); |
| 2377 } | 2328 } |
| 2378 | 2329 |
| 2379 TEST_F(VideoChannelTest, TestSetContentsNullOffer) { | 2330 TEST_F(VideoChannelTest, TestSetContentsNullOffer) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2666 EXPECT_EQ(cricket::VideoFormat::FpsToInterval(30), send_format.interval); | 2617 EXPECT_EQ(cricket::VideoFormat::FpsToInterval(30), send_format.interval); |
| 2667 | 2618 |
| 2668 // stream1: 0x0x0; stream2: 0x0x0 | 2619 // stream1: 0x0x0; stream2: 0x0x0 |
| 2669 request.static_video_views.clear(); | 2620 request.static_video_views.clear(); |
| 2670 EXPECT_TRUE(channel1_->ApplyViewRequest(request)); | 2621 EXPECT_TRUE(channel1_->ApplyViewRequest(request)); |
| 2671 EXPECT_TRUE(media_channel1_->GetSendStreamFormat(kSsrc1, &send_format)); | 2622 EXPECT_TRUE(media_channel1_->GetSendStreamFormat(kSsrc1, &send_format)); |
| 2672 EXPECT_EQ(0, send_format.width); | 2623 EXPECT_EQ(0, send_format.width); |
| 2673 EXPECT_EQ(0, send_format.height); | 2624 EXPECT_EQ(0, send_format.height); |
| 2674 } | 2625 } |
| 2675 | 2626 |
| 2676 TEST_F(VideoChannelTest, TestSetChannelOptions) { | |
| 2677 TestSetChannelOptions(); | |
| 2678 } | |
| 2679 | |
| 2680 | 2627 |
| 2681 // DataChannelTest | 2628 // DataChannelTest |
| 2682 | 2629 |
| 2683 class DataChannelTest | 2630 class DataChannelTest |
| 2684 : public ChannelTest<DataTraits> { | 2631 : public ChannelTest<DataTraits> { |
| 2685 public: | 2632 public: |
| 2686 typedef ChannelTest<DataTraits> | 2633 typedef ChannelTest<DataTraits> |
| 2687 Base; | 2634 Base; |
| 2688 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), | 2635 DataChannelTest() : Base(kDataPacket, sizeof(kDataPacket), |
| 2689 kRtcpReport, sizeof(kRtcpReport)) { | 2636 kRtcpReport, sizeof(kRtcpReport)) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2876 }; | 2823 }; |
| 2877 rtc::Buffer payload(data, 3); | 2824 rtc::Buffer payload(data, 3); |
| 2878 cricket::SendDataResult result; | 2825 cricket::SendDataResult result; |
| 2879 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 2826 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
| 2880 EXPECT_EQ(params.ssrc, | 2827 EXPECT_EQ(params.ssrc, |
| 2881 media_channel1_->last_sent_data_params().ssrc); | 2828 media_channel1_->last_sent_data_params().ssrc); |
| 2882 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 2829 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
| 2883 } | 2830 } |
| 2884 | 2831 |
| 2885 // TODO(pthatcher): TestSetReceiver? | 2832 // TODO(pthatcher): TestSetReceiver? |
| OLD | NEW |