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

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: Created 4 years, 9 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 e8800ba66f3cc7e171b008765247b0b624a74365..1d6e9489c0f99eae69fe35455f9ab7a00def4abf 100644
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
@@ -240,7 +240,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeCapturer) {
EXPECT_TRUE(channel->SetSendParameters(parameters));
// Set capturer.
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
// Verify capturer has turned off applying rotation.
EXPECT_FALSE(capturer.GetApplyRotation());
@@ -271,7 +271,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionBeforeAddSendStream) {
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
// Set capturer.
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
// Verify capturer has turned off applying rotation.
EXPECT_FALSE(capturer.GetApplyRotation());
@@ -292,7 +292,7 @@ TEST_F(WebRtcVideoEngine2Test, CVOSetHeaderExtensionAfterCapturer) {
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
// Set capturer.
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
// Verify capturer has turned on applying rotation.
EXPECT_TRUE(capturer.GetApplyRotation());
@@ -351,7 +351,7 @@ TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) {
EXPECT_TRUE(channel->SetSend(true));
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@@ -438,7 +438,7 @@ TEST_F(WebRtcVideoEngine2Test, PropagatesInputFrameTimestamp) {
channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
FakeVideoCapturer capturer;
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
capturer.Start(cricket::VideoFormat(1280, 720,
cricket::VideoFormat::FpsToInterval(60),
cricket::FOURCC_I420));
@@ -500,7 +500,7 @@ TEST_F(WebRtcVideoEngine2Test,
FakeVideoSendStream* stream = fake_call->GetVideoSendStreams()[0];
FakeVideoCapturer capturer1;
- EXPECT_TRUE(channel->SetCapturer(kSsrc, &capturer1));
+ EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer1));
cricket::CapturedFrame frame;
frame.width = 1280;
@@ -525,7 +525,7 @@ TEST_F(WebRtcVideoEngine2Test,
// Reset input source, should still be continuous even though input-frame
// timestamp is less than before.
FakeVideoCapturer capturer2;
- EXPECT_TRUE(channel->SetCapturer(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,
@@ -585,7 +585,7 @@ TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) {
EXPECT_TRUE(channel->SetSend(true));
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel->SetCapturer(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());
@@ -603,7 +603,7 @@ TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) {
prev_width = codec_settings.width;
}
- EXPECT_TRUE(channel->SetCapturer(ssrcs.front(), NULL));
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, nullptr));
channel.reset();
ASSERT_EQ(0u, encoder_factory.encoders().size());
@@ -666,7 +666,7 @@ TEST_F(WebRtcVideoEngine2Test,
// encoder adapter at a low-enough size that it'll only create a single
// encoder layer.
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel->SetCapturer(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());
@@ -720,7 +720,7 @@ TEST_F(WebRtcVideoEngine2Test, SimulcastDisabledForH264) {
cricket::VideoFormat format(
1280, 720, cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420);
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel->SetCapturer(ssrcs[0], &capturer));
+ EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], true, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(format));
EXPECT_TRUE(capturer.CaptureFrame());
@@ -728,7 +728,7 @@ TEST_F(WebRtcVideoEngine2Test, SimulcastDisabledForH264) {
FakeWebRtcVideoEncoder* encoder = encoder_factory.encoders()[0];
EXPECT_EQ(webrtc::kVideoCodecH264, encoder->GetCodecSettings().codecType);
EXPECT_EQ(1u, encoder->GetCodecSettings().numberOfSimulcastStreams);
- EXPECT_TRUE(channel->SetCapturer(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.
@@ -1049,7 +1049,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());
@@ -1537,7 +1537,7 @@ TEST_F(WebRtcVideoChannel2Test, ReconfiguresEncodersWhenNotSending) {
EXPECT_EQ(144u, streams[0].height);
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(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());
@@ -1549,7 +1549,7 @@ TEST_F(WebRtcVideoChannel2Test, ReconfiguresEncodersWhenNotSending) {
// No frames should have been actually put in there though.
EXPECT_EQ(0, stream->GetNumberOfSwappedFrames());
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) {
@@ -1560,13 +1560,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;
- EXPECT_TRUE(channel_->SetCapturer(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);
@@ -1590,13 +1589,13 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) {
EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps)
<< "Non-screenshare shouldn't use min-transmit bitrate.";
- EXPECT_TRUE(channel_->SetCapturer(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());
- EXPECT_TRUE(channel_->SetCapturer(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());
@@ -1613,7 +1612,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());
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) {
@@ -1623,7 +1622,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) {
EXPECT_TRUE(channel_->SetSend(true));
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(kSsrc, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@@ -1640,7 +1639,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());
@@ -1653,7 +1652,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());
@@ -1664,7 +1663,7 @@ TEST_F(WebRtcVideoChannel2Test, NoRecreateStreamForScreencast) {
EXPECT_EQ(webrtc::VideoEncoderConfig::ContentType::kRealtimeVideo,
encoder_config.content_type);
- EXPECT_TRUE(channel_->SetCapturer(kSsrc, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test,
@@ -1677,9 +1676,8 @@ TEST_F(WebRtcVideoChannel2Test,
AddSendStream();
VideoOptions options;
options.is_screencast = rtc::Optional<bool>(true);
- channel_->SetVideoSend(last_ssrc_, true, &options);
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(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));
@@ -1701,7 +1699,7 @@ TEST_F(WebRtcVideoChannel2Test,
EXPECT_EQ(kConferenceScreencastTemporalBitrateBps,
encoder_config.streams[0].temporal_layer_thresholds_bps[0]);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) {
@@ -1751,7 +1749,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
cricket::FakeVideoCapturer capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@@ -1775,9 +1773,9 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
EXPECT_TRUE(vp8_settings.automaticResizeOn);
EXPECT_TRUE(vp8_settings.frameDroppingOn);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
stream = SetUpSimulcast(true, false);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@@ -1790,7 +1788,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);
@@ -1808,7 +1806,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
EXPECT_FALSE(vp8_settings.automaticResizeOn);
EXPECT_FALSE(vp8_settings.frameDroppingOn);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
class Vp9SettingsTest : public WebRtcVideoChannel2Test {
@@ -1846,7 +1844,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
cricket::FakeVideoCapturer capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@@ -1872,7 +1870,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);
@@ -1887,7 +1885,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
EXPECT_FALSE(vp9_settings.denoisingOn);
EXPECT_FALSE(vp9_settings.frameDroppingOn);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
@@ -1906,7 +1904,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
cricket::FakeVideoCapturer capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@@ -1916,7 +1914,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
EXPECT_EQ(num_spatial_layers, vp9_settings.numberOfSpatialLayers);
EXPECT_EQ(num_temporal_layers, vp9_settings.numberOfTemporalLayers);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
};
@@ -1981,7 +1979,7 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
AddSendStream();
cricket::FakeVideoCapturer capturer;
- ASSERT_TRUE(channel_->SetCapturer(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));
@@ -2031,7 +2029,7 @@ TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
EXPECT_EQ(1284, send_stream->GetLastWidth());
EXPECT_EQ(724, send_stream->GetLastHeight());
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
@@ -2051,12 +2049,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;
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
@@ -2077,7 +2073,7 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
EXPECT_EQ(codec.width, send_stream->GetLastWidth());
EXPECT_EQ(codec.height, send_stream->GetLastHeight());
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
return;
}
@@ -2106,7 +2102,7 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
EXPECT_EQ(codec.width, send_stream->GetLastWidth());
EXPECT_EQ(codec.height, send_stream->GetLastHeight());
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, EstimatesNtpStartTimeCorrectly) {
@@ -2237,7 +2233,7 @@ TEST_F(WebRtcVideoChannel2Test, SetSendCodecsChangesExistingStreams) {
FakeVideoSendStream* stream = AddSendStream();
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(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());
@@ -2252,7 +2248,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);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithBitrates) {
@@ -2316,7 +2312,7 @@ TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) {
FakeVideoSendStream* stream = AddSendStream();
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
@@ -2330,7 +2326,7 @@ TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) {
EXPECT_TRUE(capturer.CaptureFrame());
streams = stream->GetVideoStreams();
EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test,
@@ -2345,7 +2341,7 @@ TEST_F(WebRtcVideoChannel2Test,
// Send a frame to make sure this scales up to >1 stream (simulcast).
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(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());
@@ -2364,7 +2360,7 @@ TEST_F(WebRtcVideoChannel2Test,
int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps);
- EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], nullptr));
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) {
@@ -2734,7 +2730,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));
- EXPECT_TRUE(channel_->SetCapturer(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, 0);
@@ -2772,7 +2769,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) {
info.senders[0].adapt_reason);
// No capturer (no adapter). Adapt changes from old adapter should be kept.
- EXPECT_TRUE(channel_->SetCapturer(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());
@@ -2784,7 +2781,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));
- EXPECT_TRUE(channel_->SetCapturer(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.
@@ -2797,7 +2795,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) {
EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_CPU,
info.senders[0].adapt_reason);
- EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) {
@@ -2809,7 +2807,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));
- EXPECT_TRUE(channel_->SetCapturer(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, 0);
@@ -2862,7 +2861,7 @@ TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationAndBandwidthStats) {
EXPECT_EQ(CoordinatedVideoAdapter::ADAPTREASON_NONE,
info.senders[0].adapt_reason);
- EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test,
@@ -3224,7 +3223,7 @@ TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) {
AddSendStream();
cricket::FakeVideoCapturer capturer;
- EXPECT_TRUE(channel_->SetCapturer(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);
@@ -3249,7 +3248,7 @@ TEST_F(WebRtcVideoChannel2Test, CanSentMaxBitrateForExistingStream) {
SetAndExpectMaxBitrate(capturer, 0, 800, 800);
SetAndExpectMaxBitrate(capturer, 0, 0, default_encoder_bitrate);
- EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannel2Test, CannotSetMaxBitrateForNonexistentStream) {
@@ -3383,7 +3382,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;
- EXPECT_TRUE(channel_->SetCapturer(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),
@@ -3440,7 +3440,7 @@ class WebRtcVideoChannel2SimulcastTest : public testing::Test {
ASSERT_EQ(1u, info.senders.size());
EXPECT_EQ(total_max_bitrate_bps, info.senders[0].preferred_bitrate);
- EXPECT_TRUE(channel_->SetCapturer(ssrcs.front(), NULL));
+ EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr));
}
FakeVideoSendStream* AddSendStream() {

Powered by Google App Engine
This is Rietveld 408576698