Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
index 177ab9f22368fd705601cc29d59300b516d6662d..3f43e5779b19c92c9b9a6959e1ed1ec8c4351cb4 100644 |
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc |
@@ -257,7 +257,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeCapturer) { |
EXPECT_TRUE(channel->SetSendParameters(parameters)); |
// Set capturer. |
- channel->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
// Verify capturer has turned off applying rotation. |
EXPECT_FALSE(capturer.apply_rotation()); |
@@ -288,7 +288,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) { |
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); |
// Set capturer. |
- channel->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
// Verify capturer has turned off applying rotation. |
EXPECT_FALSE(capturer.apply_rotation()); |
@@ -309,7 +309,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) { |
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc))); |
// Set capturer. |
- channel->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
// Verify capturer has turned on applying rotation. |
EXPECT_TRUE(capturer.apply_rotation()); |
@@ -369,7 +369,7 @@ TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { |
EXPECT_TRUE(channel->SetSend(true)); |
cricket::FakeVideoCapturer capturer; |
- channel->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -460,7 +460,7 @@ TEST_F(WebRtcVideoEngine2Test, PropagatesInputFrameTimestamp) { |
channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
FakeVideoCapturer capturer; |
- channel->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
capturer.Start(cricket::VideoFormat(1280, 720, |
cricket::VideoFormat::FpsToInterval(60), |
cricket::FOURCC_I420)); |
@@ -522,7 +522,7 @@ TEST_F(WebRtcVideoEngine2Test, |
FakeVideoSendStream* stream = fake_call->GetVideoSendStreams()[0]; |
FakeVideoCapturer capturer1; |
- channel->SetSource(kSsrc, &capturer1); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer1)); |
cricket::CapturedFrame frame; |
frame.width = 1280; |
@@ -547,7 +547,7 @@ TEST_F(WebRtcVideoEngine2Test, |
// Reset input source, should still be continuous even though input-frame |
// timestamp is less than before. |
FakeVideoCapturer capturer2; |
- channel->SetSource(kSsrc, &capturer2); |
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer2)); |
rtc::Thread::Current()->SleepMs(1); |
// Deliver with a timestamp (10 seconds) before the previous initial one, |
@@ -607,7 +607,7 @@ TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { |
EXPECT_TRUE(channel->SetSend(true)); |
cricket::FakeVideoCapturer capturer; |
- channel->SetSource(ssrcs.front(), &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -626,7 +626,7 @@ TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { |
prev_width = codec_settings.width; |
} |
- channel->SetSource(ssrcs.front(), NULL); |
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, nullptr)); |
channel.reset(); |
ASSERT_EQ(0u, encoder_factory.encoders().size()); |
@@ -689,7 +689,7 @@ TEST_F(WebRtcVideoEngine2Test, |
// encoder adapter at a low-enough size that it'll only create a single |
// encoder layer. |
cricket::FakeVideoCapturer capturer; |
- channel->SetSource(ssrcs.front(), &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -745,7 +745,7 @@ TEST_F(WebRtcVideoEngine2Test, SimulcastDisabledForH264) { |
cricket::VideoFormat format( |
1280, 720, cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420); |
cricket::FakeVideoCapturer capturer; |
- channel->SetSource(ssrcs[0], &capturer); |
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(format)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -754,7 +754,7 @@ TEST_F(WebRtcVideoEngine2Test, SimulcastDisabledForH264) { |
ASSERT_TRUE(encoder_factory.encoders()[0]->WaitForInitEncode()); |
EXPECT_EQ(webrtc::kVideoCodecH264, encoder->GetCodecSettings().codecType); |
EXPECT_EQ(1u, encoder->GetCodecSettings().numberOfSimulcastStreams); |
- channel->SetSource(ssrcs[0], nullptr); |
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], true, nullptr, nullptr)); |
} |
// Test that external codecs are added to the end of the supported codec list. |
@@ -1075,7 +1075,7 @@ class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
bool enabled) { |
cricket::VideoOptions options; |
options.video_noise_reduction = rtc::Optional<bool>(enabled); |
- channel_->SetVideoSend(ssrc, true, &options); |
+ EXPECT_TRUE(channel_->SetVideoSend(ssrc, true, &options, capturer)); |
// Options only take effect on the next frame. |
EXPECT_TRUE(capturer->CaptureFrame()); |
@@ -1558,7 +1558,7 @@ TEST_F(WebRtcVideoChannel2Test, ReconfiguresEncodersWhenNotSending) { |
EXPECT_EQ(144u, streams[0].height); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1570,7 +1570,7 @@ TEST_F(WebRtcVideoChannel2Test, ReconfiguresEncodersWhenNotSending) { |
// No frames should have been actually put in there though. |
EXPECT_EQ(0, stream->GetNumberOfSwappedFrames()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
@@ -1581,13 +1581,12 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
AddSendStream(); |
+ cricket::FakeVideoCapturer capturer; |
VideoOptions min_bitrate_options; |
min_bitrate_options.screencast_min_bitrate_kbps = |
rtc::Optional<int>(kScreenshareMinBitrateKbps); |
- channel_->SetVideoSend(last_ssrc_, true, &min_bitrate_options); |
- |
- cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &min_bitrate_options, |
+ &capturer)); |
cricket::VideoFormat capture_format_hd = |
capturer.GetSupportedFormats()->front(); |
EXPECT_EQ(1280, capture_format_hd.width); |
@@ -1611,13 +1610,13 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps) |
<< "Non-screenshare shouldn't use min-transmit bitrate."; |
- channel_->SetSource(last_ssrc_, nullptr); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
// Removing a capturer triggers a black frame to be sent. |
EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames()); |
- channel_->SetSource(last_ssrc_, &capturer); |
VideoOptions screencast_options; |
screencast_options.is_screencast = rtc::Optional<bool>(true); |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &screencast_options)); |
+ EXPECT_TRUE( |
+ channel_->SetVideoSend(last_ssrc_, true, &screencast_options, &capturer)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
// Send stream not recreated after option change. |
ASSERT_EQ(send_stream, fake_call_->GetVideoSendStreams().front()); |
@@ -1634,7 +1633,7 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { |
EXPECT_EQ(capture_format_hd.height, encoder_config.streams.front().height); |
EXPECT_TRUE(encoder_config.streams[0].temporal_layer_thresholds_bps.empty()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { |
@@ -1644,7 +1643,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { |
EXPECT_TRUE(channel_->SetSend(true)); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(kSsrc, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1661,7 +1660,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { |
* encoder, but no change of the send stream. */ |
struct VideoOptions video_options; |
video_options.is_screencast = rtc::Optional<bool>(true); |
- channel_->SetVideoSend(kSsrc, true, &video_options); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, &video_options, &capturer)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams()); |
@@ -1674,7 +1673,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { |
/* Switch back. */ |
video_options.is_screencast = rtc::Optional<bool>(false); |
- channel_->SetVideoSend(kSsrc, true, &video_options); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, &video_options, &capturer)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
ASSERT_EQ(1, fake_call_->GetNumCreatedSendStreams()); |
@@ -1685,7 +1684,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) { |
EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo, |
encoder_config.content_type); |
- channel_->SetSource(kSsrc, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, |
@@ -1698,9 +1697,8 @@ TEST_F(WebRtcVideoChannel2Test, |
AddSendStream(); |
VideoOptions options; |
options.is_screencast = rtc::Optional<bool>(true); |
- channel_->SetVideoSend(last_ssrc_, true, &options); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
cricket::VideoFormat capture_format_hd = |
capturer.GetSupportedFormats()->front(); |
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd)); |
@@ -1722,7 +1720,7 @@ TEST_F(WebRtcVideoChannel2Test, |
EXPECT_EQ(kConferenceScreencastTemporalBitrateBps, |
encoder_config.streams[0].temporal_layer_thresholds_bps[0]); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { |
@@ -1772,7 +1770,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) { |
cricket::FakeVideoCapturer capturer; |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
channel_->SetSend(true); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1796,9 +1794,9 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) { |
EXPECT_TRUE(vp8_settings.automaticResizeOn); |
EXPECT_TRUE(vp8_settings.frameDroppingOn); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
stream = SetUpSimulcast(true, false); |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
channel_->SetSend(true); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1811,7 +1809,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) { |
// In screen-share mode, denoising is forced off and simulcast disabled. |
VideoOptions options; |
options.is_screencast = rtc::Optional<bool>(true); |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options)); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
stream = SetDenoisingOption(last_ssrc_, &capturer, false); |
@@ -1829,7 +1827,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) { |
EXPECT_FALSE(vp8_settings.automaticResizeOn); |
EXPECT_FALSE(vp8_settings.frameDroppingOn); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
// Test that setting the same options doesn't result in the encoder being |
@@ -1839,21 +1837,20 @@ TEST_F(WebRtcVideoChannel2Test, SetIdenticalOptionsDoesntReconfigureEncoder) { |
cricket::FakeVideoCapturer capturer; |
FakeVideoSendStream* send_stream = AddSendStream(); |
- channel_->SetSource(last_ssrc_, &capturer); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options)); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
// Expect 2 reconfigurations at this point, from the initial configuration |
// and from the dimensions of the first frame. |
EXPECT_EQ(2, send_stream->num_encoder_reconfigurations()); |
// Set the options one more time and expect no additional reconfigurations. |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options)); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
EXPECT_TRUE(capturer.CaptureFrame()); |
EXPECT_EQ(2, send_stream->num_encoder_reconfigurations()); |
- channel_->SetSource(last_ssrc_, nullptr); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
class Vp9SettingsTest : public WebRtcVideoChannel2Test { |
@@ -1891,7 +1888,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { |
cricket::FakeVideoCapturer capturer; |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
channel_->SetSend(true); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1917,7 +1914,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { |
// In screen-share mode, denoising is forced off. |
VideoOptions options; |
options.is_screencast = rtc::Optional<bool>(true); |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options)); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
stream = SetDenoisingOption(last_ssrc_, &capturer, false); |
@@ -1932,7 +1929,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) { |
EXPECT_FALSE(vp9_settings.denoisingOn); |
EXPECT_FALSE(vp9_settings.frameDroppingOn); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest { |
@@ -1951,7 +1948,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest { |
cricket::FakeVideoCapturer capturer; |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
channel_->SetSend(true); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -1961,7 +1958,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest { |
EXPECT_EQ(num_spatial_layers, vp9_settings.numberOfSpatialLayers); |
EXPECT_EQ(num_temporal_layers, vp9_settings.numberOfTemporalLayers); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
}; |
@@ -2026,7 +2023,7 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { |
AddSendStream(); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
ASSERT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
ASSERT_TRUE(channel_->SetSend(true)); |
@@ -2084,7 +2081,7 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { |
EXPECT_EQ(1284, send_stream->GetLastWidth()); |
EXPECT_EQ(724, send_stream->GetLastHeight()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
@@ -2100,12 +2097,12 @@ TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
AddSendStream(); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
ASSERT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
ASSERT_TRUE(channel_->SetSend(true)); |
cricket::VideoOptions camera_options; |
- channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options); |
+ channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options, |
+ &capturer); |
ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size()); |
FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front(); |
@@ -2129,24 +2126,24 @@ TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
cricket::FakeVideoCapturer screen_share(true); |
ASSERT_EQ(cricket::CS_RUNNING, |
screen_share.Start(screen_share.GetSupportedFormats()->front())); |
- channel_->SetSource(last_ssrc_, &screen_share); |
cricket::VideoOptions screenshare_options; |
screenshare_options.is_screencast = rtc::Optional<bool>(true); |
- channel_->SetVideoSend(last_ssrc_, true /* enable */, &screenshare_options); |
+ channel_->SetVideoSend(last_ssrc_, true /* enable */, &screenshare_options, |
+ &screen_share); |
EXPECT_TRUE(screen_share.CaptureCustomFrame(1284, 724, cricket::FOURCC_I420)); |
EXPECT_EQ(3, send_stream->GetNumberOfSwappedFrames()); |
EXPECT_EQ(1284, send_stream->GetLastWidth()); |
EXPECT_EQ(724, send_stream->GetLastHeight()); |
// Switch back to the normal capturer. Expect the frame to be CPU adapted. |
- channel_->SetSource(last_ssrc_, &capturer); |
- channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options); |
+ channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options, |
+ &capturer); |
EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420)); |
EXPECT_EQ(4, send_stream->GetNumberOfSwappedFrames()); |
EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth()); |
EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
@@ -2166,12 +2163,10 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
AddSendStream(); |
+ cricket::FakeVideoCapturer capturer; |
VideoOptions options; |
options.is_screencast = rtc::Optional<bool>(is_screenshare); |
- EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options)); |
- |
- cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
@@ -2192,7 +2187,7 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
EXPECT_EQ(codec.width, send_stream->GetLastWidth()); |
EXPECT_EQ(codec.height, send_stream->GetLastHeight()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
return; |
} |
@@ -2221,7 +2216,7 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
EXPECT_EQ(codec.width, send_stream->GetLastWidth()); |
EXPECT_EQ(codec.height, send_stream->GetLastHeight()); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, EstimatesNtpStartTimeCorrectly) { |
@@ -2352,7 +2347,7 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { |
FakeVideoSendStream* stream = AddSendStream(); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -2367,7 +2362,7 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) { |
streams = fake_call_->GetVideoSendStreams()[0]->GetVideoStreams(); |
EXPECT_EQ(kVp8Codec360p.width, streams[0].width); |
EXPECT_EQ(kVp8Codec360p.height, streams[0].height); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithBitrates) { |
@@ -2468,7 +2463,7 @@ TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) { |
FakeVideoSendStream* stream = AddSendStream(); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
@@ -2482,7 +2477,7 @@ TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) { |
EXPECT_TRUE(capturer.CaptureFrame()); |
streams = stream->GetVideoStreams(); |
EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps); |
- channel_->SetSource(last_ssrc_, nullptr); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, |
@@ -2497,7 +2492,7 @@ TEST_F(WebRtcVideoChannel2Test, |
// Send a frame to make sure this scales up to >1 stream (simulcast). |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(kSsrcs3[0], &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, |
capturer.Start(capturer.GetSupportedFormats()->front())); |
EXPECT_TRUE(capturer.CaptureFrame()); |
@@ -2516,7 +2511,7 @@ TEST_F(WebRtcVideoChannel2Test, |
int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams); |
EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps); |
- channel_->SetSource(kSsrcs3[0], nullptr); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { |
@@ -2941,7 +2936,8 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { |
video_capturer_vga.GetSupportedFormats(); |
cricket::VideoFormat capture_format_vga = (*formats)[1]; |
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
- channel_->SetSource(kSsrcs3[0], &video_capturer_vga); |
+ EXPECT_TRUE( |
+ channel_->SetVideoSend(kSsrcs3[0], true, nullptr, &video_capturer_vga)); |
EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30); |
@@ -2978,7 +2974,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { |
info.senders[0].adapt_reason); |
// No capturer (no adapter). Adapt changes from old adapter should be kept. |
- channel_->SetSource(kSsrcs3[0], NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr)); |
info.Clear(); |
EXPECT_TRUE(channel_->GetStats(&info)); |
ASSERT_EQ(1U, info.senders.size()); |
@@ -2990,7 +2986,8 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { |
cricket::FakeVideoCapturer video_capturer_hd; |
cricket::VideoFormat capture_format_hd = (*formats)[0]; |
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_hd.Start(capture_format_hd)); |
- channel_->SetSource(kSsrcs3[0], &video_capturer_hd); |
+ EXPECT_TRUE( |
+ channel_->SetVideoSend(kSsrcs3[0], true, nullptr, &video_capturer_hd)); |
EXPECT_TRUE(video_capturer_hd.CaptureFrame()); |
// Trigger overuse, HD -> adapt (OnCpuResolutionRequest downgrade) -> HD/2. |
@@ -3002,7 +2999,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { |
EXPECT_EQ(3, info.senders[0].adapt_changes); |
EXPECT_EQ(WebRtcVideoChannel2::ADAPTREASON_CPU, info.senders[0].adapt_reason); |
- channel_->SetSource(kSsrcs3[0], NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) { |
@@ -3014,7 +3011,8 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) { |
video_capturer_vga.GetSupportedFormats(); |
cricket::VideoFormat capture_format_vga = (*formats)[1]; |
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
- channel_->SetSource(kSsrcs3[0], &video_capturer_vga); |
+ EXPECT_TRUE( |
+ channel_->SetVideoSend(kSsrcs3[0], true, nullptr, &video_capturer_vga)); |
EXPECT_TRUE(video_capturer_vga.CaptureFrame()); |
cricket::VideoCodec send_codec(100, "VP8", 640, 480, 30); |
@@ -3066,7 +3064,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) { |
EXPECT_EQ(WebRtcVideoChannel2::ADAPTREASON_NONE, |
info.senders[0].adapt_reason); |
- channel_->SetSource(kSsrcs3[0], NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, |
@@ -3432,7 +3430,7 @@ TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { |
AddSendStream(); |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(last_ssrc_, &capturer); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
cricket::VideoFormat capture_format_hd = |
capturer.GetSupportedFormats()->front(); |
EXPECT_EQ(1280, capture_format_hd.width); |
@@ -3457,7 +3455,7 @@ TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) { |
SetAndExpectMaxBitrate(capturer, 0, 800, 800); |
SetAndExpectMaxBitrate(capturer, 0, 0, default_encoder_bitrate); |
- channel_->SetSource(last_ssrc_, NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
} |
TEST_F(WebRtcVideoChannel2Test, CannotSetMaxBitrateForNonexistentStream) { |
@@ -3660,7 +3658,8 @@ class WebRtcVideoChannel2SimulcastTest : public testing::Test { |
// Send a full-size frame to trigger a stream reconfiguration to use all |
// expected simulcast layers. |
cricket::FakeVideoCapturer capturer; |
- channel_->SetSource(ssrcs.front(), &capturer); |
+ EXPECT_TRUE( |
+ channel_->SetVideoSend(ssrcs.front(), true, nullptr, &capturer)); |
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(cricket::VideoFormat( |
codec.width, codec.height, |
cricket::VideoFormat::FpsToInterval(30), |
@@ -3717,7 +3716,7 @@ class WebRtcVideoChannel2SimulcastTest : public testing::Test { |
ASSERT_EQ(1u, info.senders.size()); |
EXPECT_EQ(total_max_bitrate_bps, info.senders[0].preferred_bitrate); |
- channel_->SetSource(ssrcs.front(), NULL); |
+ EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr)); |
} |
FakeVideoSendStream* AddSendStream() { |