Delete obsolete enable argument to SetVideoSend.

This argument was previously used to implement track muting
(black frames) in the video engine, but that now happens in
the VideoTrack/VideoBroadcaster upstream.

Bug: webrtc:6983
Change-Id: Ib721b297d9fbe55b641c56690dbbd37a52edbb2f
Reviewed-on: https://webrtc-review.googlesource.com/67341
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22785}
This commit is contained in:
Niels Möller 2018-04-09 08:49:14 +02:00 committed by Commit Bot
parent a1a3869f3d
commit ff40b142c0
8 changed files with 92 additions and 115 deletions

View File

@ -577,13 +577,9 @@ class FakeVideoMediaChannel : public RtpHelper<VideoMediaChannel> {
bool SetSend(bool send) override { return set_sending(send); }
bool SetVideoSend(
uint32_t ssrc,
bool enable,
const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override {
if (!RtpHelper<VideoMediaChannel>::MuteStream(ssrc, !enable)) {
return false;
}
if (enable && options) {
if (options) {
if (!SetOptions(*options)) {
return false;
}

View File

@ -754,7 +754,6 @@ class VideoMediaChannel : public MediaChannel {
// The |ssrc| must correspond to a registered send stream.
virtual bool SetVideoSend(
uint32_t ssrc,
bool enable,
const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) = 0;
// Sets the sink object to be used for the specified stream.

View File

@ -91,7 +91,7 @@ class VideoMediaChannelTest : public testing::Test,
cricket::FOURCC_I420);
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_->Start(format));
EXPECT_TRUE(
channel_->SetVideoSend(kSsrc, true, nullptr, video_capturer_.get()));
channel_->SetVideoSend(kSsrc, nullptr, video_capturer_.get()));
}
virtual cricket::FakeVideoCapturerWithTaskQueue* CreateFakeVideoCapturer() {
@ -128,7 +128,7 @@ class VideoMediaChannelTest : public testing::Test,
cricket::FOURCC_I420);
EXPECT_EQ(cricket::CS_RUNNING, video_capturer_2_->Start(format));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc + 2, true, nullptr,
EXPECT_TRUE(channel_->SetVideoSend(kSsrc + 2, nullptr,
video_capturer_2_.get()));
}
virtual void TearDown() {
@ -263,7 +263,7 @@ class VideoMediaChannelTest : public testing::Test,
void SetSend() {
EXPECT_FALSE(channel_->sending());
EXPECT_TRUE(
channel_->SetVideoSend(kSsrc, true, nullptr, video_capturer_.get()));
channel_->SetVideoSend(kSsrc, nullptr, video_capturer_.get()));
EXPECT_TRUE(SetOneCodec(DefaultCodec()));
EXPECT_FALSE(channel_->sending());
EXPECT_TRUE(SetSend(true));
@ -469,7 +469,7 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format));
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(5678)));
EXPECT_TRUE(channel_->SetVideoSend(5678, true, nullptr, capturer.get()));
EXPECT_TRUE(channel_->SetVideoSend(5678, nullptr, capturer.get()));
EXPECT_TRUE(channel_->AddRecvStream(
cricket::StreamParams::CreateLegacy(5678)));
EXPECT_TRUE(channel_->SetSink(5678, &renderer2));
@ -504,7 +504,7 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_EQ(kTestWidth, info.senders[1].send_frame_width);
EXPECT_EQ(kTestHeight, info.senders[1].send_frame_height);
// The capturer must be unregistered here as it runs out of it's scope next.
channel_->SetVideoSend(5678, true, nullptr, nullptr);
channel_->SetVideoSend(5678, nullptr, nullptr);
}
// Test that we can set the bandwidth.
@ -542,7 +542,7 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(999)));
EXPECT_TRUE(
channel_->SetVideoSend(999u, true, nullptr, video_capturer_.get()));
channel_->SetVideoSend(999u, nullptr, video_capturer_.get()));
EXPECT_TRUE(SetSend(true));
EXPECT_TRUE(WaitAndSendFrame(0));
EXPECT_TRUE_WAIT(NumRtpPackets() > 0, kTimeout);
@ -609,7 +609,7 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_TRUE(channel_->AddSendStream(
cricket::StreamParams::CreateLegacy(789u)));
EXPECT_TRUE(
channel_->SetVideoSend(789u, true, nullptr, video_capturer_.get()));
channel_->SetVideoSend(789u, nullptr, video_capturer_.get()));
EXPECT_EQ(rtp_packets, NumRtpPackets());
// Wait 30ms to guarantee the engine does not drop the frame.
EXPECT_TRUE(WaitAndSendFrame(30));
@ -681,7 +681,7 @@ class VideoMediaChannelTest : public testing::Test,
// test which is related to screencast logic.
VideoOptions video_options;
video_options.is_screencast = true;
channel_->SetVideoSend(kSsrc, true, &video_options, nullptr);
channel_->SetVideoSend(kSsrc, &video_options, nullptr);
VideoFormat format(480, 360, VideoFormat::FpsToInterval(30), FOURCC_I420);
EXPECT_EQ(cricket::CS_RUNNING, capturer->Start(format));
@ -692,7 +692,7 @@ class VideoMediaChannelTest : public testing::Test,
int captured_frames = 1;
for (int iterations = 0; iterations < 2; ++iterations) {
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, capturer.get()));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, capturer.get()));
rtc::Thread::Current()->ProcessMessages(time_between_send_ms);
EXPECT_TRUE(capturer->CaptureCustomFrame(format.width, format.height));
++captured_frames;
@ -706,7 +706,7 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_EQ(format.height, renderer_.height());
captured_frames = renderer_.num_rendered_frames() + 1;
EXPECT_FALSE(renderer_.black_frame());
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, nullptr));
// Make sure a black frame is generated within the specified timeout.
// The black frame should be the resolution of the previous frame to
// prevent expensive encoder reconfigurations.
@ -741,10 +741,10 @@ class VideoMediaChannelTest : public testing::Test,
// tightly.
rtc::Thread::Current()->ProcessMessages(30);
// Remove the capturer.
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, nullptr));
// No capturer was added, so this SetVideoSend shouldn't do anything.
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, nullptr));
rtc::Thread::Current()->ProcessMessages(300);
// Verify no more frames were sent.
EXPECT_EQ(1, renderer_.num_rendered_frames());
@ -790,8 +790,8 @@ class VideoMediaChannelTest : public testing::Test,
// A limitation in the lmi implementation requires that SetVideoSend() is
// called after SetOneCodec().
// TODO(hellner): this seems like an unnecessary constraint, fix it.
EXPECT_TRUE(channel_->SetVideoSend(1, true, nullptr, capturer1.get()));
EXPECT_TRUE(channel_->SetVideoSend(2, true, nullptr, capturer2.get()));
EXPECT_TRUE(channel_->SetVideoSend(1, nullptr, capturer1.get()));
EXPECT_TRUE(channel_->SetVideoSend(2, nullptr, capturer2.get()));
EXPECT_TRUE(SetSend(true));
// Test capturer associated with engine.
const int kTestWidth = 160;
@ -804,11 +804,11 @@ class VideoMediaChannelTest : public testing::Test,
EXPECT_FRAME_ON_RENDERER_WAIT(
renderer2, 1, kTestWidth, kTestHeight, kTimeout);
// Successfully remove the capturer.
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(kSsrc, nullptr, nullptr));
// The capturers must be unregistered here as it runs out of it's scope
// next.
EXPECT_TRUE(channel_->SetVideoSend(1, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(2, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(1, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(2, nullptr, nullptr));
}
// Test that multiple send streams can be created and deleted properly.

View File

@ -1064,17 +1064,13 @@ bool WebRtcVideoChannel::SetSend(bool send) {
return true;
}
// TODO(nisse): The enable argument was used for mute logic which has
// been moved to VideoBroadcaster. So remove the argument from this
// method.
bool WebRtcVideoChannel::SetVideoSend(
uint32_t ssrc,
bool enable,
const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
TRACE_EVENT0("webrtc", "SetVideoSend");
RTC_DCHECK(ssrc != 0);
RTC_LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc << ", enable = " << enable
RTC_LOG(LS_INFO) << "SetVideoSend (ssrc= " << ssrc
<< ", options: "
<< (options ? options->ToString() : "nullptr")
<< ", source = " << (source ? "(source)" : "nullptr") << ")";
@ -1088,7 +1084,7 @@ bool WebRtcVideoChannel::SetVideoSend(
return false;
}
return kv->second->SetVideoSend(enable, options, source);
return kv->second->SetVideoSend(options, source);
}
bool WebRtcVideoChannel::ValidateSendSsrcAvailability(
@ -1665,16 +1661,12 @@ WebRtcVideoChannel::WebRtcVideoSendStream::~WebRtcVideoSendStream() {
}
bool WebRtcVideoChannel::WebRtcVideoSendStream::SetVideoSend(
bool enable,
const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
TRACE_EVENT0("webrtc", "WebRtcVideoSendStream::SetVideoSend");
RTC_DCHECK_RUN_ON(&thread_checker_);
// Ignore |options| pointer if |enable| is false.
bool options_present = enable && options;
if (options_present) {
if (options) {
VideoOptions old_options = parameters_.options;
parameters_.options.SetAll(*options);
if (parameters_.options.is_screencast.value_or(false) !=

View File

@ -150,7 +150,6 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
bool SetSend(bool send) override;
bool SetVideoSend(
uint32_t ssrc,
bool enable,
const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override;
bool AddSendStream(const StreamParams& sp) override;
@ -280,8 +279,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
const rtc::VideoSinkWants& wants) override;
void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
bool SetVideoSend(bool mute,
const VideoOptions* options,
bool SetVideoSend(const VideoOptions* options,
rtc::VideoSourceInterface<webrtc::VideoFrame>* source);
void SetSend(bool send);

View File

@ -312,7 +312,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeCapturer) {
EXPECT_TRUE(channel->SetSendParameters(parameters));
// Set capturer.
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
// Verify capturer has turned off applying rotation.
EXPECT_FALSE(capturer.apply_rotation());
@ -341,7 +341,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeAddSendStream) {
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
// Set capturer.
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
// Verify capturer has turned off applying rotation.
EXPECT_FALSE(capturer.apply_rotation());
@ -357,7 +357,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionAfterCapturer) {
EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(kSsrc)));
// Set capturer.
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
// Verify capturer has turned on applying rotation.
EXPECT_TRUE(capturer.apply_rotation());
@ -413,7 +413,7 @@ TEST_F(WebRtcVideoEngineTest, UseExternalFactoryForVp8WhenSupported) {
EXPECT_EQ(0, encoder_factory_->GetNumCreatedEncoders());
EXPECT_TRUE(channel->SetSend(true));
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@ -529,7 +529,7 @@ TEST_F(WebRtcVideoEngineTest, PropagatesInputFrameTimestamp) {
channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
capturer.Start(cricket::VideoFormat(1280, 720,
cricket::VideoFormat::FpsToInterval(60),
cricket::FOURCC_I420));
@ -638,7 +638,7 @@ TEST_F(WebRtcVideoEngineTest, UsesSimulcastAdapterForVp8Factories) {
EXPECT_TRUE(channel->SetSend(true));
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@ -657,7 +657,7 @@ TEST_F(WebRtcVideoEngineTest, UsesSimulcastAdapterForVp8Factories) {
prev_width = codec_settings.width;
}
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, nullptr));
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), nullptr, nullptr));
channel.reset();
ASSERT_EQ(0u, encoder_factory_->encoders().size());
@ -715,7 +715,7 @@ TEST_F(WebRtcVideoEngineTest,
// encoder adapter at a low-enough size that it'll only create a single
// encoder layer.
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(ssrcs.front(), nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@ -749,7 +749,7 @@ TEST_F(WebRtcVideoEngineTest,
cricket::VideoFormat format(
1280, 720, cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420);
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(format));
EXPECT_TRUE(capturer.CaptureFrame());
ASSERT_TRUE(encoder_factory_->encoders()[0]->WaitForInitEncode());
@ -774,7 +774,7 @@ TEST_F(WebRtcVideoEngineTest, SimulcastDisabledForH264) {
cricket::VideoFormat format(
1280, 720, cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420);
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], true, nullptr, &capturer));
EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(format));
EXPECT_TRUE(capturer.CaptureFrame());
@ -783,7 +783,7 @@ TEST_F(WebRtcVideoEngineTest, SimulcastDisabledForH264) {
ASSERT_TRUE(encoder_factory_->encoders()[0]->WaitForInitEncode());
EXPECT_EQ(webrtc::kVideoCodecH264, encoder->GetCodecSettings().codecType);
EXPECT_EQ(1u, encoder->GetCodecSettings().numberOfSimulcastStreams);
EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], true, nullptr, nullptr));
EXPECT_TRUE(channel->SetVideoSend(ssrcs[0], nullptr, nullptr));
}
// Test that the FlexFEC field trial properly alters the output of
@ -1098,7 +1098,7 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_RecreatesEncoderOnContentTypeChange) {
FakeVideoCapturerWithTaskQueue capturer;
VideoOptions options;
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, &options, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
@ -1107,13 +1107,13 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_RecreatesEncoderOnContentTypeChange) {
EXPECT_EQ(webrtc::kRealtimeVideo,
encoder_factory_->encoders().back()->GetCodecSettings().mode);
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, &options, &capturer));
EXPECT_TRUE(capturer.CaptureFrame());
// No change in content type, keep current encoder.
EXPECT_EQ(1, encoder_factory_->GetNumCreatedEncoders());
options.is_screencast.emplace(true);
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, &options, &capturer));
EXPECT_TRUE(capturer.CaptureFrame());
// Change to screen content, recreate encoder. For the simulcast encoder
// adapter case, this will result in two calls since InitEncode triggers a
@ -1122,14 +1122,14 @@ TEST_F(WebRtcVideoEngineTest, DISABLED_RecreatesEncoderOnContentTypeChange) {
EXPECT_EQ(webrtc::kScreensharing,
encoder_factory_->encoders().back()->GetCodecSettings().mode);
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, &options, &capturer));
EXPECT_TRUE(capturer.CaptureFrame());
// Still screen content, no need to update encoder.
EXPECT_EQ(2, encoder_factory_->GetNumCreatedEncoders());
options.is_screencast.emplace(false);
options.video_noise_reduction.emplace(false);
EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, &options, &capturer));
EXPECT_TRUE(channel->SetVideoSend(kSsrc, &options, &capturer));
// Change back to regular video content, update encoder. Also change
// a non |is_screencast| option just to verify it doesn't affect recreation.
EXPECT_TRUE(capturer.CaptureFrame());
@ -1418,7 +1418,7 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
bool enabled) {
cricket::VideoOptions options;
options.video_noise_reduction = enabled;
EXPECT_TRUE(channel_->SetVideoSend(ssrc, true, &options, capturer));
EXPECT_TRUE(channel_->SetVideoSend(ssrc, &options, capturer));
// Options only take effect on the next frame.
EXPECT_TRUE(capturer->CaptureFrame());
@ -1895,7 +1895,7 @@ TEST_F(WebRtcVideoChannelTest, ReconfiguresEncodersWhenNotSending) {
EXPECT_EQ(0u, streams[0].height);
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
VideoFormat capture_format = capturer.GetSupportedFormats()->front();
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format));
EXPECT_TRUE(capturer.CaptureFrame());
@ -1905,7 +1905,7 @@ TEST_F(WebRtcVideoChannelTest, ReconfiguresEncodersWhenNotSending) {
EXPECT_EQ(capture_format.width, streams[0].width);
EXPECT_EQ(capture_format.height, streams[0].height);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
@ -1919,7 +1919,7 @@ TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
FakeVideoCapturerWithTaskQueue capturer;
VideoOptions min_bitrate_options;
min_bitrate_options.screencast_min_bitrate_kbps = kScreenshareMinBitrateKbps;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &min_bitrate_options,
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &min_bitrate_options,
&capturer));
cricket::VideoFormat capture_format_hd =
capturer.GetSupportedFormats()->front();
@ -1946,12 +1946,12 @@ TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
EXPECT_EQ(0, encoder_config.min_transmit_bitrate_bps)
<< "Non-screenshare shouldn't use min-transmit bitrate.";
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames());
VideoOptions screencast_options;
screencast_options.is_screencast = true;
EXPECT_TRUE(
channel_->SetVideoSend(last_ssrc_, true, &screencast_options, &capturer));
channel_->SetVideoSend(last_ssrc_, &screencast_options, &capturer));
EXPECT_TRUE(capturer.CaptureFrame());
// Send stream recreated after option change.
ASSERT_EQ(2, fake_call_->GetNumCreatedSendStreams());
@ -1969,7 +1969,7 @@ TEST_F(WebRtcVideoChannelTest, UsesCorrectSettingsForScreencast) {
EXPECT_EQ(capture_format_hd.width, streams.front().width);
EXPECT_EQ(capture_format_hd.height, streams.front().height);
EXPECT_FALSE(streams[0].num_temporal_layers.has_value());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest,
@ -1983,7 +1983,7 @@ TEST_F(WebRtcVideoChannelTest,
VideoOptions options;
options.is_screencast = true;
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
cricket::VideoFormat capture_format_hd =
capturer.GetSupportedFormats()->front();
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format_hd));
@ -2008,7 +2008,7 @@ TEST_F(WebRtcVideoChannelTest,
EXPECT_EQ(kConferenceScreencastTemporalBitrateBps,
streams[0].target_bitrate_bps);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, SuspendBelowMinBitrateDisabledByDefault) {
@ -2060,7 +2060,7 @@ TEST_F(WebRtcVideoChannelTest, VerifyVp8SpecificSettings) {
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@ -2084,9 +2084,9 @@ TEST_F(WebRtcVideoChannelTest, VerifyVp8SpecificSettings) {
EXPECT_TRUE(vp8_settings.automaticResizeOn);
EXPECT_TRUE(vp8_settings.frameDroppingOn);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
stream = SetUpSimulcast(true, false);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@ -2099,7 +2099,7 @@ TEST_F(WebRtcVideoChannelTest, VerifyVp8SpecificSettings) {
// In screen-share mode, denoising is forced off and simulcast disabled.
VideoOptions options;
options.is_screencast = true;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
stream = SetDenoisingOption(last_ssrc_, &capturer, false);
@ -2117,7 +2117,7 @@ TEST_F(WebRtcVideoChannelTest, VerifyVp8SpecificSettings) {
EXPECT_FALSE(vp8_settings.automaticResizeOn);
EXPECT_FALSE(vp8_settings.frameDroppingOn);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
// Test that setting the same options doesn't result in the encoder being
@ -2134,22 +2134,22 @@ TEST_F(WebRtcVideoChannelTest, SetIdenticalOptionsDoesntReconfigureEncoder) {
ASSERT_TRUE(channel_->SetSendParameters(parameters));
FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
EXPECT_TRUE(capturer.CaptureFrame());
// Expect 1 reconfigurations at this point from the initial configuration.
EXPECT_EQ(1, send_stream->num_encoder_reconfigurations());
// Set the options one more time and expect no additional reconfigurations.
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
EXPECT_EQ(1, send_stream->num_encoder_reconfigurations());
// Change |options| and expect 2 reconfigurations.
options.video_noise_reduction = true;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
EXPECT_EQ(2, send_stream->num_encoder_reconfigurations());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
class Vp9SettingsTest : public WebRtcVideoChannelTest {
@ -2179,7 +2179,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@ -2205,7 +2205,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
// In screen-share mode, denoising is forced off.
VideoOptions options;
options.is_screencast = true;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
stream = SetDenoisingOption(last_ssrc_, &capturer, false);
@ -2220,7 +2220,7 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
EXPECT_FALSE(vp9_settings.denoisingOn);
EXPECT_FALSE(vp9_settings.frameDroppingOn);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(Vp9SettingsTest, MultipleSsrcsEnablesSvc) {
@ -2239,7 +2239,7 @@ TEST_F(Vp9SettingsTest, MultipleSsrcsEnablesSvc) {
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(channel_->SetVideoSend(ssrcs[0], true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(ssrcs[0], nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@ -2252,7 +2252,7 @@ TEST_F(Vp9SettingsTest, MultipleSsrcsEnablesSvc) {
EXPECT_EQ(vp9_settings.numberOfSpatialLayers, kNumSpatialLayers);
EXPECT_EQ(vp9_settings.numberOfTemporalLayers, kNumTemporalLayers);
EXPECT_TRUE(channel_->SetVideoSend(ssrcs[0], true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(ssrcs[0], nullptr, nullptr));
}
class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
@ -2271,7 +2271,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
channel_->SetSend(true);
EXPECT_TRUE(capturer.CaptureFrame());
@ -2281,7 +2281,7 @@ class Vp9SettingsTestWithFieldTrial : public Vp9SettingsTest {
EXPECT_EQ(num_spatial_layers, vp9_settings.numberOfSpatialLayers);
EXPECT_EQ(num_temporal_layers, vp9_settings.numberOfTemporalLayers);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
};
@ -2379,7 +2379,7 @@ TEST_F(WebRtcVideoChannelTest, AdaptsOnOveruseAndChangeResolution) {
AddSendStream();
FakeVideoCapturerWithTaskQueue capturer;
ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
ASSERT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
ASSERT_TRUE(channel_->SetSend(true));
@ -2442,7 +2442,7 @@ TEST_F(WebRtcVideoChannelTest, AdaptsOnOveruseAndChangeResolution) {
EXPECT_EQ(1284, send_stream->GetLastWidth());
EXPECT_EQ(724, send_stream->GetLastHeight());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
@ -2465,7 +2465,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
ASSERT_TRUE(channel_->SetSend(true));
cricket::VideoOptions camera_options;
camera_options.is_screencast = false;
channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options,
channel_->SetVideoSend(last_ssrc_, &camera_options,
&capturer);
ASSERT_EQ(1u, fake_call_->GetVideoSendStreams().size());
@ -2492,7 +2492,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
screen_share.Start(screen_share.GetSupportedFormats()->front()));
cricket::VideoOptions screenshare_options;
screenshare_options.is_screencast = true;
channel_->SetVideoSend(last_ssrc_, true /* enable */, &screenshare_options,
channel_->SetVideoSend(last_ssrc_, &screenshare_options,
&screen_share);
EXPECT_TRUE(screen_share.CaptureCustomFrame(1284, 724));
ASSERT_EQ(2, fake_call_->GetNumCreatedSendStreams());
@ -2502,7 +2502,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
EXPECT_EQ(724, send_stream->GetLastHeight());
// Switch back to the normal capturer. Expect the frame to be CPU adapted.
channel_->SetVideoSend(last_ssrc_, true /* enable */, &camera_options,
channel_->SetVideoSend(last_ssrc_, &camera_options,
&capturer);
send_stream = fake_call_->GetVideoSendStreams().front();
// We have a new fake send stream, so it doesn't remember the old sink wants.
@ -2516,7 +2516,7 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth());
EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
// TODO(asapersson): Remove this test when the balanced field trial is removed.
@ -2539,7 +2539,7 @@ void WebRtcVideoChannelTest::TestDegradationPreference(
FakeVideoCapturerWithTaskQueue capturer;
VideoOptions options;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front();
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format));
@ -2550,7 +2550,7 @@ void WebRtcVideoChannelTest::TestDegradationPreference(
send_stream->resolution_scaling_enabled());
EXPECT_EQ(fps_scaling_enabled, send_stream->framerate_scaling_enabled());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
@ -2575,7 +2575,7 @@ void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
FakeVideoCapturerWithTaskQueue capturer;
VideoOptions options;
options.is_screencast = is_screenshare;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, &options, &capturer));
cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front();
capture_format.interval = rtc::kNumNanosecsPerSec / kDefaultFps;
EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format));
@ -2595,7 +2595,7 @@ void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
EXPECT_EQ(capture_format.width, send_stream->GetLastWidth());
EXPECT_EQ(capture_format.height, send_stream->GetLastHeight());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
return;
}
@ -2656,7 +2656,7 @@ void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
EXPECT_EQ(capture_format.width, send_stream->GetLastWidth());
EXPECT_EQ(capture_format.height, send_stream->GetLastHeight());
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, EstimatesNtpStartTimeCorrectly) {
@ -3135,7 +3135,7 @@ TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
FakeVideoSendStream* stream = AddSendStream();
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
EXPECT_EQ(kDefaultQpMax, streams[0].max_qp);
@ -3146,7 +3146,7 @@ TEST_F(WebRtcVideoChannelTest, SetSendCodecsChangesExistingStreams) {
ASSERT_TRUE(channel_->SetSendParameters(parameters));
streams = fake_call_->GetVideoSendStreams()[0]->GetVideoStreams();
EXPECT_EQ(kDefaultQpMax + 1, streams[0].max_qp);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithBitrates) {
@ -3251,7 +3251,7 @@ TEST_F(WebRtcVideoChannelTest, SetMaxSendBitrateCanIncreaseSenderBitrate) {
FakeVideoSendStream* stream = AddSendStream();
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
@ -3265,7 +3265,7 @@ TEST_F(WebRtcVideoChannelTest, SetMaxSendBitrateCanIncreaseSenderBitrate) {
EXPECT_TRUE(capturer.CaptureFrame());
streams = stream->GetVideoStreams();
EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest,
@ -3280,7 +3280,7 @@ TEST_F(WebRtcVideoChannelTest,
// Send a frame to make sure this scales up to >1 stream (simulcast).
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], nullptr, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(capturer.GetSupportedFormats()->front()));
EXPECT_TRUE(capturer.CaptureFrame());
@ -3299,7 +3299,7 @@ TEST_F(WebRtcVideoChannelTest,
int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps);
EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(kSsrcs3[0], nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithMaxQuantization) {
@ -4418,7 +4418,7 @@ TEST_F(WebRtcVideoChannelTest, CanSentMaxBitrateForExistingStream) {
AddSendStream();
FakeVideoCapturerWithTaskQueue capturer;
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, &capturer));
cricket::VideoFormat capture_format_hd =
capturer.GetSupportedFormats()->front();
EXPECT_EQ(1280, capture_format_hd.width);
@ -4443,7 +4443,7 @@ TEST_F(WebRtcVideoChannelTest, CanSentMaxBitrateForExistingStream) {
SetAndExpectMaxBitrate(0, 800, 800);
SetAndExpectMaxBitrate(0, 0, default_encoder_bitrate);
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, nullptr, nullptr));
}
TEST_F(WebRtcVideoChannelTest, CannotSetMaxBitrateForNonexistentStream) {
@ -4559,7 +4559,7 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersPrioritySimulcastStreams) {
// reconfiguring, and allows us to test this behavior.
FakeVideoCapturerWithTaskQueue capturer;
VideoOptions options;
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, &options, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(cricket::VideoFormat(
1920, 1080, cricket::VideoFormat::FpsToInterval(30),
@ -4605,7 +4605,7 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersPrioritySimulcastStreams) {
video_send_stream->GetVideoStreams()[1].bitrate_priority);
EXPECT_EQ(rtc::nullopt,
video_send_stream->GetVideoStreams()[2].bitrate_priority);
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, nullptr, nullptr));
}
// Test that a stream will not be sending if its encoding is made inactive
@ -4645,7 +4645,7 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersMultipleEncodingsActive) {
// appropriately.
cricket::FakeVideoCapturerWithTaskQueue capturer;
VideoOptions options;
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, true, &options, &capturer));
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, &options, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
capturer.Start(cricket::VideoFormat(
1920, 1080, cricket::VideoFormat::FpsToInterval(30),
@ -4702,7 +4702,7 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersMultipleEncodingsActive) {
EXPECT_FALSE(simulcast_streams[1].active);
EXPECT_FALSE(simulcast_streams[2].active);
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, nullptr, nullptr));
}
// Test that if a stream is reconfigured (due to a codec change or other
@ -5013,7 +5013,7 @@ class WebRtcVideoChannelSimulcastTest : public testing::Test {
if (screenshare)
options.is_screencast = screenshare;
EXPECT_TRUE(
channel_->SetVideoSend(ssrcs.front(), true, &options, &capturer));
channel_->SetVideoSend(ssrcs.front(), &options, &capturer));
// Fetch the latest stream since SetVideoSend() may recreate it if the
// screen content setting is changed.
FakeVideoSendStream* stream = fake_call_.GetVideoSendStreams().front();
@ -5107,7 +5107,7 @@ class WebRtcVideoChannelSimulcastTest : public testing::Test {
}
}
EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr));
EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), nullptr, nullptr));
}
FakeVideoSendStream* AddSendStream() {

View File

@ -309,7 +309,6 @@ VideoRtpSender::VideoRtpSender(rtc::Thread* worker_thread,
id_(track ? track->id() : rtc::CreateRandomUuid()),
stream_ids_(stream_ids),
track_(track),
cached_track_enabled_(track ? track->enabled() : false),
cached_track_content_hint_(track
? track->content_hint()
: VideoTrackInterface::ContentHint::kNone),
@ -327,9 +326,7 @@ VideoRtpSender::~VideoRtpSender() {
void VideoRtpSender::OnChanged() {
TRACE_EVENT0("webrtc", "VideoRtpSender::OnChanged");
RTC_DCHECK(!stopped_);
if (cached_track_enabled_ != track_->enabled() ||
cached_track_content_hint_ != track_->content_hint()) {
cached_track_enabled_ = track_->enabled();
if (cached_track_content_hint_ != track_->content_hint()) {
cached_track_content_hint_ = track_->content_hint();
if (can_send_track()) {
SetVideoSend();
@ -362,7 +359,6 @@ bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) {
rtc::scoped_refptr<VideoTrackInterface> old_track = track_;
track_ = video_track;
if (track_) {
cached_track_enabled_ = track_->enabled();
cached_track_content_hint_ = track_->content_hint();
track_->RegisterObserver(this);
}
@ -455,11 +451,8 @@ void VideoRtpSender::SetVideoSend() {
options.is_screencast = true;
break;
}
// |track_->enabled()| hops to the signaling thread, so call it before we hop
// to the worker thread or else it will deadlock.
bool track_enabled = track_->enabled();
bool success = worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
return media_channel_->SetVideoSend(ssrc_, track_enabled, &options, track_);
return media_channel_->SetVideoSend(ssrc_, &options, track_);
});
RTC_DCHECK(success);
}
@ -475,7 +468,7 @@ void VideoRtpSender::ClearVideoSend() {
// This the normal case when the underlying media channel has already been
// deleted.
worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
return media_channel_->SetVideoSend(ssrc_, false, nullptr, nullptr);
return media_channel_->SetVideoSend(ssrc_, nullptr, nullptr);
});
}

View File

@ -254,7 +254,6 @@ class VideoRtpSender : public ObserverInterface,
cricket::VideoMediaChannel* media_channel_ = nullptr;
rtc::scoped_refptr<VideoTrackInterface> track_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
VideoTrackInterface::ContentHint cached_track_content_hint_ =
VideoTrackInterface::ContentHint::kNone;
bool stopped_ = false;