Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1838413002: Combining SetVideoSend and SetSource into one method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressing pbos@'s comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
index b3357d2c61bfe19e90646d31fc94d4a42728d419..d87df06928eb3a2f419a966d60a563d22cd4b22b 100644
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
@@ -241,7 +241,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.GetApplyRotation());
@@ -272,7 +272,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.GetApplyRotation());
@@ -293,7 +293,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.GetApplyRotation());
@@ -353,7 +353,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());
@@ -442,7 +442,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));
@@ -504,7 +504,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;
@@ -529,7 +529,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,
@@ -589,7 +589,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());
@@ -608,7 +608,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());
@@ -671,7 +671,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());
@@ -727,7 +727,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());
@@ -736,7 +736,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.
@@ -1062,7 +1062,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());
@@ -1552,7 +1552,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());
@@ -1564,7 +1564,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) {
@@ -1575,13 +1575,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);
@@ -1605,13 +1604,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());
@@ -1628,7 +1627,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) {
@@ -1638,7 +1637,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());
@@ -1655,7 +1654,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());
@@ -1668,7 +1667,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());
@@ -1679,7 +1678,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,
@@ -1692,9 +1691,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));
@@ -1716,7 +1714,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) {
@@ -1766,7 +1764,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());
@@ -1790,9 +1788,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());
@@ -1805,7 +1803,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);
@@ -1823,7 +1821,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
@@ -1833,21 +1831,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 {
@@ -1885,7 +1882,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());
@@ -1911,7 +1908,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);
@@ -1926,7 +1923,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 {
@@ -1945,7 +1942,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());
@@ -1955,7 +1952,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));
}
};
@@ -2020,7 +2017,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));
@@ -2078,7 +2075,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) {
@@ -2094,12 +2091,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();
@@ -2123,24 +2120,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,
@@ -2160,12 +2157,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()));
@@ -2186,7 +2181,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;
}
@@ -2215,7 +2210,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) {
@@ -2346,7 +2341,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());
@@ -2361,7 +2356,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) {
@@ -2462,7 +2457,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()));
@@ -2476,7 +2471,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,
@@ -2491,7 +2486,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());
@@ -2510,7 +2505,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) {
@@ -2899,7 +2894,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);
@@ -2936,7 +2932,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());
@@ -2948,7 +2944,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.
@@ -2960,7 +2957,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) {
@@ -2972,7 +2969,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);
@@ -3024,7 +3022,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,
@@ -3390,7 +3388,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);
@@ -3415,7 +3413,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) {
@@ -3586,7 +3584,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),
@@ -3643,7 +3642,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() {

Powered by Google App Engine
This is Rietveld 408576698