| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 StreamParams sp = cricket::StreamParams::CreateLegacy(kSsrc); | 899 StreamParams sp = cricket::StreamParams::CreateLegacy(kSsrc); |
| 900 sp.id = "FakeStreamParamsId"; | 900 sp.id = "FakeStreamParamsId"; |
| 901 EXPECT_TRUE(channel->AddRecvStream(sp)); | 901 EXPECT_TRUE(channel->AddRecvStream(sp)); |
| 902 EXPECT_EQ(1u, decoder_factory.decoders().size()); | 902 EXPECT_EQ(1u, decoder_factory.decoders().size()); |
| 903 | 903 |
| 904 std::vector<cricket::VideoDecoderParams> params = decoder_factory.params(); | 904 std::vector<cricket::VideoDecoderParams> params = decoder_factory.params(); |
| 905 ASSERT_EQ(1u, params.size()); | 905 ASSERT_EQ(1u, params.size()); |
| 906 EXPECT_EQ(sp.id, params[0].receive_stream_id); | 906 EXPECT_EQ(sp.id, params[0].receive_stream_id); |
| 907 } | 907 } |
| 908 | 908 |
| 909 TEST_F(WebRtcVideoEngine2Test, RecreatesEncoderOnContentTypeChange) { |
| 910 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 911 encoder_factory.AddSupportedVideoCodecType("VP8"); |
| 912 std::unique_ptr<FakeCall> fake_call( |
| 913 new FakeCall(webrtc::Call::Config(&event_log_))); |
| 914 std::unique_ptr<VideoMediaChannel> channel( |
| 915 SetUpForExternalEncoderFactory(&encoder_factory)); |
| 916 ASSERT_TRUE( |
| 917 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 918 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
| 919 cricket::VideoSendParameters parameters; |
| 920 parameters.codecs.push_back(codec); |
| 921 channel->OnReadyToSend(true); |
| 922 channel->SetSend(true); |
| 923 ASSERT_TRUE(channel->SetSendParameters(parameters)); |
| 924 |
| 925 cricket::FakeVideoCapturer capturer; |
| 926 VideoOptions options; |
| 927 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer)); |
| 928 |
| 929 EXPECT_EQ(cricket::CS_RUNNING, |
| 930 capturer.Start(capturer.GetSupportedFormats()->front())); |
| 931 EXPECT_TRUE(capturer.CaptureFrame()); |
| 932 ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(1)); |
| 933 EXPECT_EQ(webrtc::kRealtimeVideo, |
| 934 encoder_factory.encoders().back()->GetCodecSettings().mode); |
| 935 |
| 936 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer)); |
| 937 EXPECT_TRUE(capturer.CaptureFrame()); |
| 938 // No change in content type, keep current encoder. |
| 939 EXPECT_EQ(1, encoder_factory.GetNumCreatedEncoders()); |
| 940 |
| 941 options.is_screencast.emplace(true); |
| 942 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer)); |
| 943 EXPECT_TRUE(capturer.CaptureFrame()); |
| 944 // Change to screen content, recreate encoder. For the simulcast encoder |
| 945 // adapter case, this will result in two calls since InitEncode triggers a |
| 946 // a new instance. |
| 947 ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(2)); |
| 948 EXPECT_EQ(webrtc::kScreensharing, |
| 949 encoder_factory.encoders().back()->GetCodecSettings().mode); |
| 950 |
| 951 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer)); |
| 952 EXPECT_TRUE(capturer.CaptureFrame()); |
| 953 // Still screen content, no need to update encoder. |
| 954 EXPECT_EQ(2, encoder_factory.GetNumCreatedEncoders()); |
| 955 |
| 956 options.is_screencast.emplace(false); |
| 957 options.video_noise_reduction.emplace(false); |
| 958 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer)); |
| 959 // Change back to regular video content, update encoder. Also change |
| 960 // a non |is_screencast| option just to verify it doesn't affect recreation. |
| 961 EXPECT_TRUE(capturer.CaptureFrame()); |
| 962 ASSERT_TRUE(encoder_factory.WaitForCreatedVideoEncoders(3)); |
| 963 EXPECT_EQ(webrtc::kRealtimeVideo, |
| 964 encoder_factory.encoders().back()->GetCodecSettings().mode); |
| 965 |
| 966 // Remove stream previously added to free the external encoder instance. |
| 967 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 968 EXPECT_EQ(0u, encoder_factory.encoders().size()); |
| 969 } |
| 970 |
| 909 #define WEBRTC_BASE_TEST(test) \ | 971 #define WEBRTC_BASE_TEST(test) \ |
| 910 TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); } | 972 TEST_F(WebRtcVideoChannel2BaseTest, test) { Base::test(); } |
| 911 | 973 |
| 912 #define WEBRTC_DISABLED_BASE_TEST(test) \ | 974 #define WEBRTC_DISABLED_BASE_TEST(test) \ |
| 913 TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_##test) { Base::test(); } | 975 TEST_F(WebRtcVideoChannel2BaseTest, DISABLED_##test) { Base::test(); } |
| 914 | 976 |
| 915 WEBRTC_BASE_TEST(SetSend); | 977 WEBRTC_BASE_TEST(SetSend); |
| 916 WEBRTC_BASE_TEST(SetSendWithoutCodecs); | 978 WEBRTC_BASE_TEST(SetSendWithoutCodecs); |
| 917 WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes); | 979 WEBRTC_BASE_TEST(SetSendSetsTransportBufferSizes); |
| 918 | 980 |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) | 1723 EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) |
| 1662 << "Non-screenshare shouldn't use min-transmit bitrate."; | 1724 << "Non-screenshare shouldn't use min-transmit bitrate."; |
| 1663 | 1725 |
| 1664 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 1726 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
| 1665 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); | 1727 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 1666 VideoOptions screencast_options; | 1728 VideoOptions screencast_options; |
| 1667 screencast_options.is_screencast = rtc::Optional<bool>(true); | 1729 screencast_options.is_screencast = rtc::Optional<bool>(true); |
| 1668 EXPECT_TRUE( | 1730 EXPECT_TRUE( |
| 1669 channel_->SetVideoSend(last_ssrc_, true, &screencast_options, &capturer)); | 1731 channel_->SetVideoSend(last_ssrc_, true, &screencast_options, &capturer)); |
| 1670 EXPECT_TRUE(capturer.CaptureFrame()); | 1732 EXPECT_TRUE(capturer.CaptureFrame()); |
| 1671 // Send stream not recreated after option change. | 1733 // Send stream recreated after option change. |
| 1672 ASSERT_EQ(send_stream, fake_call_->GetVideoSendStreams().front()); | 1734 ASSERT_EQ(2, fake_call_->GetNumCreatedSendStreams()); |
| 1673 EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); | 1735 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 1736 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 1674 | 1737 |
| 1675 // Verify screencast settings. | 1738 // Verify screencast settings. |
| 1676 encoder_config = send_stream->GetEncoderConfig().Copy(); | 1739 encoder_config = send_stream->GetEncoderConfig().Copy(); |
| 1677 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, | 1740 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, |
| 1678 encoder_config.content_type); | 1741 encoder_config.content_type); |
| 1679 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000, | 1742 EXPECT_EQ(kScreenshareMinBitrateKbps * 1000, |
| 1680 encoder_config.min_transmit_bitrate_bps); | 1743 encoder_config.min_transmit_bitrate_bps); |
| 1681 | 1744 |
| 1682 streams = send_stream->GetVideoStreams(); | 1745 streams = send_stream->GetVideoStreams(); |
| 1683 EXPECT_EQ(capture_format_hd.width, streams.front().width); | 1746 EXPECT_EQ(capture_format_hd.width, streams.front().width); |
| 1684 EXPECT_EQ(capture_format_hd.height, streams.front().height); | 1747 EXPECT_EQ(capture_format_hd.height, streams.front().height); |
| 1685 EXPECT_TRUE(streams[0].temporal_layer_thresholds_bps.empty()); | 1748 EXPECT_TRUE(streams[0].temporal_layer_thresholds_bps.empty()); |
| 1686 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 1749 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
| 1687 } | 1750 } |
| 1688 | 1751 |
| 1689 TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { | |
| 1690 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | |
| 1691 ASSERT_TRUE( | |
| 1692 channel_->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); | |
| 1693 EXPECT_TRUE(channel_->SetSend(true)); | |
| 1694 | |
| 1695 cricket::FakeVideoCapturer capturer; | |
| 1696 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, &capturer)); | |
| 1697 EXPECT_EQ(cricket::CS_RUNNING, | |
| 1698 capturer.Start(capturer.GetSupportedFormats()->front())); | |
| 1699 EXPECT_TRUE(capturer.CaptureFrame()); | |
| 1700 | |
| 1701 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams()); | |
| 1702 FakeVideoSendStream* stream = fake_call_->GetVideoSendStreams().front(); | |
| 1703 webrtc::VideoEncoderConfig encoder_config = stream->GetEncoderConfig().Copy(); | |
| 1704 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, | |
| 1705 encoder_config.content_type); | |
| 1706 | |
| 1707 EXPECT_EQ(1, stream->GetNumberOfSwappedFrames()); | |
| 1708 | |
| 1709 /* Switch to screencast source. We expect a reconfigure of the | |
| 1710 * encoder, but no change of the send stream. */ | |
| 1711 struct VideoOptions video_options; | |
| 1712 video_options.is_screencast = rtc::Optional<bool>(true); | |
| 1713 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, &video_options, &capturer)); | |
| 1714 | |
| 1715 EXPECT_TRUE(capturer.CaptureFrame()); | |
| 1716 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams()); | |
| 1717 ASSERT_EQ(stream, fake_call_->GetVideoSendStreams().front()); | |
| 1718 EXPECT_EQ(2, stream->GetNumberOfSwappedFrames()); | |
| 1719 | |
| 1720 encoder_config = stream->GetEncoderConfig().Copy(); | |
| 1721 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kScreen, | |
| 1722 encoder_config.content_type); | |
| 1723 | |
| 1724 /* Switch back. */ | |
| 1725 video_options.is_screencast = rtc::Optional<bool>(false); | |
| 1726 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, &video_options, &capturer)); | |
| 1727 | |
| 1728 EXPECT_TRUE(capturer.CaptureFrame()); | |
| 1729 ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams()); | |
| 1730 ASSERT_EQ(stream, fake_call_->GetVideoSendStreams().front()); | |
| 1731 EXPECT_EQ(3, stream->GetNumberOfSwappedFrames()); | |
| 1732 | |
| 1733 encoder_config = stream->GetEncoderConfig().Copy(); | |
| 1734 EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, | |
| 1735 encoder_config.content_type); | |
| 1736 | |
| 1737 EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); | |
| 1738 } | |
| 1739 | |
| 1740 TEST_F(WebRtcVideoChannel2Test, | 1752 TEST_F(WebRtcVideoChannel2Test, |
| 1741 ConferenceModeScreencastConfiguresTemporalLayer) { | 1753 ConferenceModeScreencastConfiguresTemporalLayer) { |
| 1742 static const int kConferenceScreencastTemporalBitrateBps = | 1754 static const int kConferenceScreencastTemporalBitrateBps = |
| 1743 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000; | 1755 ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000; |
| 1744 send_parameters_.conference_mode = true; | 1756 send_parameters_.conference_mode = true; |
| 1745 channel_->SetSendParameters(send_parameters_); | 1757 channel_->SetSendParameters(send_parameters_); |
| 1746 | 1758 |
| 1747 AddSendStream(); | 1759 AddSendStream(); |
| 1748 VideoOptions options; | 1760 VideoOptions options; |
| 1749 options.is_screencast = rtc::Optional<bool>(true); | 1761 options.is_screencast = rtc::Optional<bool>(true); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); | 1915 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
| 1904 EXPECT_TRUE(capturer.CaptureFrame()); | 1916 EXPECT_TRUE(capturer.CaptureFrame()); |
| 1905 // Expect 1 reconfigurations at this point from the initial configuration. | 1917 // Expect 1 reconfigurations at this point from the initial configuration. |
| 1906 EXPECT_EQ(1, send_stream->num_encoder_reconfigurations()); | 1918 EXPECT_EQ(1, send_stream->num_encoder_reconfigurations()); |
| 1907 | 1919 |
| 1908 // Set the options one more time and expect no additional reconfigurations. | 1920 // Set the options one more time and expect no additional reconfigurations. |
| 1909 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); | 1921 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
| 1910 EXPECT_EQ(1, send_stream->num_encoder_reconfigurations()); | 1922 EXPECT_EQ(1, send_stream->num_encoder_reconfigurations()); |
| 1911 | 1923 |
| 1912 // Change |options| and expect 2 reconfigurations. | 1924 // Change |options| and expect 2 reconfigurations. |
| 1913 options.is_screencast = rtc::Optional<bool>(true); | 1925 options.video_noise_reduction = rtc::Optional<bool>(true); |
| 1914 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); | 1926 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
| 1915 EXPECT_EQ(2, send_stream->num_encoder_reconfigurations()); | 1927 EXPECT_EQ(2, send_stream->num_encoder_reconfigurations()); |
| 1916 | 1928 |
| 1917 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 1929 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
| 1918 } | 1930 } |
| 1919 | 1931 |
| 1920 class Vp9SettingsTest : public WebRtcVideoChannel2Test { | 1932 class Vp9SettingsTest : public WebRtcVideoChannel2Test { |
| 1921 public: | 1933 public: |
| 1922 Vp9SettingsTest() : Vp9SettingsTest("") {} | 1934 Vp9SettingsTest() : Vp9SettingsTest("") {} |
| 1923 explicit Vp9SettingsTest(const char* field_trials) | 1935 explicit Vp9SettingsTest(const char* field_trials) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2197 | 2209 |
| 2198 // Switch to screen share. Expect no CPU adaptation. | 2210 // Switch to screen share. Expect no CPU adaptation. |
| 2199 cricket::FakeVideoCapturer screen_share(true); | 2211 cricket::FakeVideoCapturer screen_share(true); |
| 2200 ASSERT_EQ(cricket::CS_RUNNING, | 2212 ASSERT_EQ(cricket::CS_RUNNING, |
| 2201 screen_share.Start(screen_share.GetSupportedFormats()->front())); | 2213 screen_share.Start(screen_share.GetSupportedFormats()->front())); |
| 2202 cricket::VideoOptions screenshare_options; | 2214 cricket::VideoOptions screenshare_options; |
| 2203 screenshare_options.is_screencast = rtc::Optional<bool>(true); | 2215 screenshare_options.is_screencast = rtc::Optional<bool>(true); |
| 2204 channel_->SetVideoSend(last_ssrc_, true /* enable */, &screenshare_options, | 2216 channel_->SetVideoSend(last_ssrc_, true /* enable */, &screenshare_options, |
| 2205 &screen_share); | 2217 &screen_share); |
| 2206 EXPECT_TRUE(screen_share.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); | 2218 EXPECT_TRUE(screen_share.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); |
| 2207 EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames()); | 2219 ASSERT_EQ(2, fake_call_->GetNumCreatedSendStreams()); |
| 2220 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 2221 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 2208 EXPECT_EQ(1284, send_stream->GetLastWidth()); | 2222 EXPECT_EQ(1284, send_stream->GetLastWidth()); |
| 2209 EXPECT_EQ(724, send_stream->GetLastHeight()); | 2223 EXPECT_EQ(724, send_stream->GetLastHeight()); |
| 2210 | 2224 |
| 2211 // Switch back to the normal capturer. Expect the frame to be CPU adapted. | 2225 // Switch back to the normal capturer. Expect the frame to be CPU adapted. |
| 2212 channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options, | 2226 channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options, |
| 2213 &capturer); | 2227 &capturer); |
| 2228 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 2229 // We have a new fake send stream, so it doesn't remember the old sink wants. |
| 2230 // In practice, it will be populated from |
| 2231 // ViEEncoder::VideoSourceProxy::SetSource(), so simulate that here. |
| 2232 send_stream->InjectVideoSinkWants(wants); |
| 2214 EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420)); | 2233 EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420)); |
| 2215 EXPECT_EQ(4, send_stream->GetNumberOfSwappedFrames()); | 2234 ASSERT_EQ(3, fake_call_->GetNumCreatedSendStreams()); |
| 2235 send_stream = fake_call_->GetVideoSendStreams().front(); |
| 2236 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); |
| 2216 EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth()); | 2237 EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth()); |
| 2217 EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight()); | 2238 EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight()); |
| 2218 | 2239 |
| 2219 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 2240 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
| 2220 } | 2241 } |
| 2221 | 2242 |
| 2222 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, | 2243 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
| 2223 bool is_screenshare) { | 2244 bool is_screenshare) { |
| 2224 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2245 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
| 2225 cricket::VideoSendParameters parameters; | 2246 cricket::VideoSendParameters parameters; |
| (...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4163 | 4184 |
| 4164 protected: | 4185 protected: |
| 4165 void VerifySimulcastSettings(const VideoCodec& codec, | 4186 void VerifySimulcastSettings(const VideoCodec& codec, |
| 4166 int capture_width, | 4187 int capture_width, |
| 4167 int capture_height, | 4188 int capture_height, |
| 4168 size_t num_configured_streams, | 4189 size_t num_configured_streams, |
| 4169 size_t expected_num_streams, | 4190 size_t expected_num_streams, |
| 4170 bool screenshare, | 4191 bool screenshare, |
| 4171 bool conference_mode) { | 4192 bool conference_mode) { |
| 4172 cricket::VideoSendParameters parameters; | 4193 cricket::VideoSendParameters parameters; |
| 4173 VideoOptions options; | |
| 4174 parameters.codecs.push_back(codec); | 4194 parameters.codecs.push_back(codec); |
| 4175 parameters.conference_mode = conference_mode; | 4195 parameters.conference_mode = conference_mode; |
| 4176 if (screenshare) { | |
| 4177 options.is_screencast = rtc::Optional<bool>(screenshare); | |
| 4178 } | |
| 4179 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 4196 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
| 4180 | 4197 |
| 4181 std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs3); | 4198 std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs3); |
| 4182 RTC_DCHECK(num_configured_streams <= ssrcs.size()); | 4199 RTC_DCHECK(num_configured_streams <= ssrcs.size()); |
| 4183 ssrcs.resize(num_configured_streams); | 4200 ssrcs.resize(num_configured_streams); |
| 4184 | 4201 |
| 4185 FakeVideoSendStream* stream = | 4202 AddSendStream(CreateSimStreamParams("cname", ssrcs)); |
| 4186 AddSendStream(CreateSimStreamParams("cname", ssrcs)); | |
| 4187 // Send a full-size frame to trigger a stream reconfiguration to use all | 4203 // Send a full-size frame to trigger a stream reconfiguration to use all |
| 4188 // expected simulcast layers. | 4204 // expected simulcast layers. |
| 4189 cricket::FakeVideoCapturer capturer; | 4205 cricket::FakeVideoCapturer capturer; |
| 4206 VideoOptions options; |
| 4207 if (screenshare) |
| 4208 options.is_screencast = rtc::Optional<bool>(screenshare); |
| 4190 EXPECT_TRUE( | 4209 EXPECT_TRUE( |
| 4191 channel_->SetVideoSend(ssrcs.front(), true, &options, &capturer)); | 4210 channel_->SetVideoSend(ssrcs.front(), true, &options, &capturer)); |
| 4211 // Fetch the latest stream since SetVideoSend() may recreate it if the |
| 4212 // screen content setting is changed. |
| 4213 FakeVideoSendStream* stream = fake_call_.GetVideoSendStreams().front(); |
| 4192 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(cricket::VideoFormat( | 4214 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(cricket::VideoFormat( |
| 4193 capture_width, capture_height, | 4215 capture_width, capture_height, |
| 4194 cricket::VideoFormat::FpsToInterval(30), | 4216 cricket::VideoFormat::FpsToInterval(30), |
| 4195 cricket::FOURCC_I420))); | 4217 cricket::FOURCC_I420))); |
| 4196 channel_->SetSend(true); | 4218 channel_->SetSend(true); |
| 4197 EXPECT_TRUE(capturer.CaptureFrame()); | 4219 EXPECT_TRUE(capturer.CaptureFrame()); |
| 4198 | 4220 |
| 4199 std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); | 4221 std::vector<webrtc::VideoStream> video_streams = stream->GetVideoStreams(); |
| 4200 ASSERT_EQ(expected_num_streams, video_streams.size()); | 4222 ASSERT_EQ(expected_num_streams, video_streams.size()); |
| 4201 | 4223 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4342 } | 4364 } |
| 4343 | 4365 |
| 4344 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { | 4366 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { |
| 4345 webrtc::test::ScopedFieldTrials override_field_trials_( | 4367 webrtc::test::ScopedFieldTrials override_field_trials_( |
| 4346 "WebRTC-SimulcastScreenshare/Enabled/"); | 4368 "WebRTC-SimulcastScreenshare/Enabled/"); |
| 4347 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, | 4369 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, |
| 4348 true); | 4370 true); |
| 4349 } | 4371 } |
| 4350 | 4372 |
| 4351 } // namespace cricket | 4373 } // namespace cricket |
| OLD | NEW |