Revert "Reland "Distinguish between send and receive video codecs""

This reverts commit 26e6afe93f134c844d739384784e78acc07cc145.

Reason for revert: Breaks another downstream test.

Original change's description:
> Reland "Distinguish between send and receive video codecs"
> 
> This reverts commit f22af3cca7cfe517e4126db4b7083475722c3e6d.
> 
> Reason for revert: Downstream tests have been updated.
> 
> Original change's description:
> > Revert "Distinguish between send and receive video codecs"
> > 
> > This reverts commit 18314bd8d2cb27fa58e4d304bbc428e3ed1736ba.
> > 
> > Reason for revert: Breaks downstream test.
> > 
> > Original change's description:
> > > Distinguish between send and receive video codecs
> > > 
> > > Even though send and receive codecs are the same,
> > > they might have different support in HW.
> > > Distinguish between send and receive codecs to be able to keep
> > > track of which codecs have HW support.
> > > 
> > > Bug: chromium:1029737
> > > Change-Id: I16a80da44c5061ca42f2aabda76e6bf0b879bf7b
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161306
> > > Reviewed-by: Anders Carlsson <andersc@webrtc.org>
> > > Reviewed-by: Steve Anton <steveanton@webrtc.org>
> > > Commit-Queue: Johannes Kron <kron@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#30041}
> > 
> > TBR=steveanton@webrtc.org,andersc@webrtc.org,kron@webrtc.org
> > 
> > Change-Id: I7e5807460006db613e9b3b369ec6036b88f164fd
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: chromium:1029737
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161662
> > Reviewed-by: Johannes Kron <kron@webrtc.org>
> > Commit-Queue: Johannes Kron <kron@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#30042}
> 
> TBR=steveanton@webrtc.org,andersc@webrtc.org,kron@webrtc.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: chromium:1029737
> Change-Id: Ia70b11376b43888e2495ef21838c2d2e3c68d735
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161734
> Reviewed-by: Johannes Kron <kron@webrtc.org>
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Reviewed-by: Anders Carlsson <andersc@webrtc.org>
> Commit-Queue: Johannes Kron <kron@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30078}

TBR=steveanton@webrtc.org,andersc@webrtc.org,kron@webrtc.org

Change-Id: Ia4971b898c9209a3736a916a1c2c48d392dfdad6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1029737
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162140
Reviewed-by: Johannes Kron <kron@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30079}
This commit is contained in:
Johannes Kron
2019-12-12 22:30:12 +00:00
committed by Commit Bot
parent 26e6afe93f
commit f2d6fe62f2
13 changed files with 109 additions and 191 deletions

View File

@ -265,7 +265,7 @@ class WebRtcVideoEngineTest : public ::testing::Test {
// Find the codec in the engine with the given name. The codec must be
// present.
cricket::VideoCodec GetEngineCodec(const std::string& name) const;
void AddSupportedVideoCodecType(const std::string& name);
VideoMediaChannel* SetSendParamsWithAllSupportedCodecs();
VideoMediaChannel* SetRecvParamsWithSupportedCodecs(
@ -296,7 +296,7 @@ TEST_F(WebRtcVideoEngineTest, DefaultRtxCodecHasAssociatedPayloadTypeSet) {
encoder_factory_->AddSupportedVideoCodecType("VP8");
AssignDefaultCodec();
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
std::vector<VideoCodec> engine_codecs = engine_.codecs();
for (size_t i = 0; i < engine_codecs.size(); ++i) {
if (engine_codecs[i].name != kRtxCodecName)
continue;
@ -375,7 +375,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeCapturer) {
// dtor is called.
::testing::NiceMock<MockVideoSource> video_source;
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -414,7 +414,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeAddSendStream) {
// dtor is called.
::testing::NiceMock<MockVideoSource> video_source;
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -438,8 +438,8 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionBeforeAddSendStream) {
TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionAfterCapturer) {
::testing::NiceMock<MockVideoSource> video_source;
AddSupportedVideoCodecType("VP8");
AddSupportedVideoCodecType("VP9");
encoder_factory_->AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP9");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -483,7 +483,7 @@ TEST_F(WebRtcVideoEngineTest, CVOSetHeaderExtensionAfterCapturer) {
}
TEST_F(WebRtcVideoEngineTest, SetSendFailsBeforeSettingCodecs) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(engine_.CreateMediaChannel(
call_.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
@ -498,7 +498,7 @@ TEST_F(WebRtcVideoEngineTest, SetSendFailsBeforeSettingCodecs) {
}
TEST_F(WebRtcVideoEngineTest, GetStatsWithoutSendCodecsSetDoesNotCrash) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(engine_.CreateMediaChannel(
call_.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
@ -509,7 +509,7 @@ TEST_F(WebRtcVideoEngineTest, GetStatsWithoutSendCodecsSetDoesNotCrash) {
}
TEST_F(WebRtcVideoEngineTest, UseFactoryForVp8WhenSupported) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -569,7 +569,7 @@ TEST_F(WebRtcVideoEngineTest, RtxCodecAddedForH264Codec) {
encoder_factory_->AddSupportedVideoCodec(h264_high);
// First figure out what payload types the test codecs got assigned.
const std::vector<cricket::VideoCodec> codecs = engine_.send_codecs();
const std::vector<cricket::VideoCodec> codecs = engine_.codecs();
// Now search for RTX codecs for them. Expect that they all have associated
// RTX codecs.
EXPECT_TRUE(HasRtxCodec(
@ -586,7 +586,7 @@ TEST_F(WebRtcVideoEngineTest, RtxCodecAddedForH264Codec) {
#if defined(RTC_ENABLE_VP9)
TEST_F(WebRtcVideoEngineTest, CanConstructDecoderForVp9EncoderFactory) {
AddSupportedVideoCodecType("VP9");
encoder_factory_->AddSupportedVideoCodecType("VP9");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -597,7 +597,7 @@ TEST_F(WebRtcVideoEngineTest, CanConstructDecoderForVp9EncoderFactory) {
#endif // defined(RTC_ENABLE_VP9)
TEST_F(WebRtcVideoEngineTest, PropagatesInputFrameTimestamp) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
FakeCall* fake_call = new FakeCall();
call_.reset(fake_call);
std::unique_ptr<VideoMediaChannel> channel(
@ -651,7 +651,7 @@ TEST_F(WebRtcVideoEngineTest, PropagatesInputFrameTimestamp) {
}
void WebRtcVideoEngineTest::AssignDefaultAptRtxTypes() {
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
std::vector<VideoCodec> engine_codecs = engine_.codecs();
RTC_DCHECK(!engine_codecs.empty());
for (const cricket::VideoCodec& codec : engine_codecs) {
if (codec.name == "rtx") {
@ -665,7 +665,7 @@ void WebRtcVideoEngineTest::AssignDefaultAptRtxTypes() {
}
void WebRtcVideoEngineTest::AssignDefaultCodec() {
std::vector<VideoCodec> engine_codecs = engine_.send_codecs();
std::vector<VideoCodec> engine_codecs = engine_.codecs();
RTC_DCHECK(!engine_codecs.empty());
bool codec_set = false;
for (const cricket::VideoCodec& codec : engine_codecs) {
@ -681,7 +681,7 @@ void WebRtcVideoEngineTest::AssignDefaultCodec() {
size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
const std::string& name) const {
const std::vector<cricket::VideoCodec> codecs = engine_.send_codecs();
const std::vector<cricket::VideoCodec> codecs = engine_.codecs();
for (size_t i = 0; i < codecs.size(); ++i) {
const cricket::VideoCodec engine_codec = codecs[i];
if (!absl::EqualsIgnoreCase(name, engine_codec.name))
@ -705,13 +705,7 @@ size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
cricket::VideoCodec WebRtcVideoEngineTest::GetEngineCodec(
const std::string& name) const {
return engine_.send_codecs()[GetEngineCodecIndex(name)];
}
void WebRtcVideoEngineTest::AddSupportedVideoCodecType(
const std::string& name) {
encoder_factory_->AddSupportedVideoCodecType(name);
decoder_factory_->AddSupportedVideoCodecType(name);
return engine_.codecs()[GetEngineCodecIndex(name)];
}
VideoMediaChannel*
@ -760,7 +754,7 @@ void WebRtcVideoEngineTest::ExpectRtpCapabilitySupport(const char* uri,
}
TEST_F(WebRtcVideoEngineTest, UsesSimulcastAdapterForVp8Factories) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
std::unique_ptr<VideoMediaChannel> channel(
SetSendParamsWithAllSupportedCodecs());
@ -797,8 +791,8 @@ TEST_F(WebRtcVideoEngineTest, UsesSimulcastAdapterForVp8Factories) {
}
TEST_F(WebRtcVideoEngineTest, ChannelWithH264CanChangeToVp8) {
AddSupportedVideoCodecType("VP8");
AddSupportedVideoCodecType("H264");
encoder_factory_->AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("H264");
// Frame source.
webrtc::test::FrameForwarder frame_forwarder;
@ -832,8 +826,8 @@ TEST_F(WebRtcVideoEngineTest, ChannelWithH264CanChangeToVp8) {
TEST_F(WebRtcVideoEngineTest,
UsesSimulcastAdapterForVp8WithCombinedVP8AndH264Factory) {
AddSupportedVideoCodecType("VP8");
AddSupportedVideoCodecType("H264");
encoder_factory_->AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("H264");
std::unique_ptr<VideoMediaChannel> channel(engine_.CreateMediaChannel(
call_.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
@ -868,8 +862,8 @@ TEST_F(WebRtcVideoEngineTest,
TEST_F(WebRtcVideoEngineTest,
DestroysNonSimulcastEncoderFromCombinedVP8AndH264Factory) {
AddSupportedVideoCodecType("VP8");
AddSupportedVideoCodecType("H264");
encoder_factory_->AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("H264");
std::unique_ptr<VideoMediaChannel> channel(engine_.CreateMediaChannel(
call_.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
@ -902,7 +896,7 @@ TEST_F(WebRtcVideoEngineTest, SimulcastEnabledForH264BehindFieldTrial) {
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-H264Simulcast/Enabled/");
AddSupportedVideoCodecType("H264");
encoder_factory_->AddSupportedVideoCodecType("H264");
std::unique_ptr<VideoMediaChannel> channel(engine_.CreateMediaChannel(
call_.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
@ -942,13 +936,13 @@ TEST_F(WebRtcVideoEngineTest,
auto flexfec = Field("name", &VideoCodec::name, "flexfec-03");
// FlexFEC is not active without field trial.
EXPECT_THAT(engine_.send_codecs(), Not(Contains(flexfec)));
EXPECT_THAT(engine_.codecs(), Not(Contains(flexfec)));
// FlexFEC is active with field trial.
RTC_DCHECK(!override_field_trials_);
override_field_trials_ = std::make_unique<webrtc::test::ScopedFieldTrials>(
"WebRTC-FlexFEC-03-Advertised/Enabled/");
EXPECT_THAT(engine_.send_codecs(), Contains(flexfec));
EXPECT_THAT(engine_.codecs(), Contains(flexfec));
}
// Test that codecs are added in the order they are reported from the factory.
@ -972,11 +966,11 @@ TEST_F(WebRtcVideoEngineTest, ReportSupportedAddedCodec) {
// Set up external encoder factory with first codec, and initialize engine.
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName1);
std::vector<cricket::VideoCodec> codecs_before(engine_.send_codecs());
std::vector<cricket::VideoCodec> codecs_before(engine_.codecs());
// Add second codec.
encoder_factory_->AddSupportedVideoCodecType(kFakeExternalCodecName2);
std::vector<cricket::VideoCodec> codecs_after(engine_.send_codecs());
std::vector<cricket::VideoCodec> codecs_after(engine_.codecs());
// The codec itself and RTX should have been added.
EXPECT_EQ(codecs_before.size() + 2, codecs_after.size());
@ -992,11 +986,12 @@ TEST_F(WebRtcVideoEngineTest, ReportRtxForExternalCodec) {
encoder_factory_->AddSupportedVideoCodecType(kFakeCodecName);
const size_t fake_codec_index = GetEngineCodecIndex(kFakeCodecName);
EXPECT_EQ("rtx", engine_.send_codecs().at(fake_codec_index + 1).name);
EXPECT_EQ("rtx", engine_.codecs().at(fake_codec_index + 1).name);
}
TEST_F(WebRtcVideoEngineTest, RegisterDecodersIfSupported) {
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
decoder_factory_->AddSupportedVideoCodecType(webrtc::SdpVideoFormat("VP8"));
cricket::VideoRecvParameters parameters;
parameters.codecs.push_back(GetEngineCodec("VP8"));
@ -1041,7 +1036,8 @@ TEST_F(WebRtcVideoEngineTest, RegisterH264DecoderIfSupported) {
// empty list of RtpSource without crashing.
TEST_F(WebRtcVideoEngineTest, GetSourcesWithNonExistingSsrc) {
// Setup an recv stream with |kSsrc|.
AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP8");
decoder_factory_->AddSupportedVideoCodecType(webrtc::SdpVideoFormat("VP8"));
cricket::VideoRecvParameters parameters;
parameters.codecs.push_back(GetEngineCodec("VP8"));
std::unique_ptr<VideoMediaChannel> channel(
@ -1060,8 +1056,7 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, NullFactories) {
std::unique_ptr<webrtc::VideoDecoderFactory> decoder_factory;
WebRtcVideoEngine engine(std::move(encoder_factory),
std::move(decoder_factory));
EXPECT_EQ(0u, engine.send_codecs().size());
EXPECT_EQ(0u, engine.recv_codecs().size());
EXPECT_EQ(0u, engine.codecs().size());
}
TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, EmptyFactories) {
@ -1074,8 +1069,7 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, EmptyFactories) {
(std::unique_ptr<webrtc::VideoEncoderFactory>(encoder_factory)),
(std::unique_ptr<webrtc::VideoDecoderFactory>(decoder_factory)));
EXPECT_CALL(*encoder_factory, GetSupportedFormats());
EXPECT_EQ(0u, engine.send_codecs().size());
EXPECT_EQ(0u, engine.recv_codecs().size());
EXPECT_EQ(0u, engine.codecs().size());
EXPECT_CALL(*encoder_factory, Die());
EXPECT_CALL(*decoder_factory, Die());
}
@ -1104,11 +1098,9 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) {
const std::vector<webrtc::SdpVideoFormat> supported_formats = {vp8_format};
EXPECT_CALL(*encoder_factory, GetSupportedFormats())
.WillRepeatedly(::testing::Return(supported_formats));
EXPECT_CALL(*decoder_factory, GetSupportedFormats())
.WillRepeatedly(::testing::Return(supported_formats));
// Verify the codecs from the engine.
const std::vector<VideoCodec> engine_codecs = engine.send_codecs();
const std::vector<VideoCodec> engine_codecs = engine.codecs();
// Verify default codecs has been added correctly.
EXPECT_EQ(5u, engine_codecs.size());
EXPECT_EQ("VP8", engine_codecs.at(0).name);
@ -1241,14 +1233,12 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, NullDecoder) {
const auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
// Create recv channel.
EXPECT_CALL(*decoder_factory, GetSupportedFormats())
.WillRepeatedly(::testing::Return(supported_formats));
const int recv_ssrc = 321;
std::unique_ptr<VideoMediaChannel> recv_channel(engine.CreateMediaChannel(
call.get(), GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
rate_allocator_factory.get()));
cricket::VideoRecvParameters recv_parameters;
recv_parameters.codecs.push_back(engine.recv_codecs().front());
recv_parameters.codecs.push_back(engine.codecs().front());
EXPECT_TRUE(recv_channel->SetRecvParameters(recv_parameters));
EXPECT_TRUE(recv_channel->AddRecvStream(
cricket::StreamParams::CreateLegacy(recv_ssrc)));
@ -1336,9 +1326,9 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
webrtc::CreateBuiltinVideoBitrateAllocatorFactory()),
engine_(
webrtc::CreateBuiltinVideoEncoderFactory(),
std::make_unique<webrtc::test::FunctionVideoDecoderFactory>(
[]() { return std::make_unique<webrtc::test::FakeDecoder>(); },
kSdpVideoFormats)),
std::make_unique<webrtc::test::FunctionVideoDecoderFactory>([]() {
return std::make_unique<webrtc::test::FakeDecoder>();
})),
channel_(absl::WrapUnique(static_cast<cricket::WebRtcVideoChannel*>(
engine_.CreateMediaChannel(
call_.get(),
@ -1349,7 +1339,7 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
network_interface_.SetDestination(channel_.get());
channel_->SetInterface(&network_interface_, webrtc::MediaTransportConfig());
cricket::VideoRecvParameters parameters;
parameters.codecs = engine_.recv_codecs();
parameters.codecs = engine_.codecs();
channel_->SetRecvParameters(parameters);
}
@ -1373,7 +1363,6 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
EXPECT_EQ(0, renderer_.errors());
}
static const std::vector<webrtc::SdpVideoFormat> kSdpVideoFormats;
webrtc::FieldTrialBasedConfig field_trials_;
webrtc::RtcEventLogNull event_log_;
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
@ -1386,10 +1375,6 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
cricket::FakeVideoRenderer renderer_;
};
const std::vector<webrtc::SdpVideoFormat>
WebRtcVideoChannelEncodedFrameCallbackTest::kSdpVideoFormats = {
webrtc::SdpVideoFormat("VP8")};
TEST_F(WebRtcVideoChannelEncodedFrameCallbackTest,
SetEncodedFrameBufferFunction_DefaultStream) {
testing::MockFunction<void(const webrtc::RecordableEncodedFrame&)> callback;
@ -1495,7 +1480,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
network_interface_.SetDestination(channel_.get());
channel_->SetInterface(&network_interface_, webrtc::MediaTransportConfig());
cricket::VideoRecvParameters parameters;
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
channel_->SetRecvParameters(parameters);
EXPECT_TRUE(channel_->AddSendStream(DefaultSendStreamParams()));
frame_forwarder_ = std::make_unique<webrtc::test::FrameForwarder>();
@ -1643,7 +1628,7 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
}
cricket::VideoCodec GetEngineCodec(const std::string& name) {
for (const cricket::VideoCodec& engine_codec : engine_.send_codecs()) {
for (const cricket::VideoCodec& engine_codec : engine_.codecs()) {
if (absl::EqualsIgnoreCase(name, engine_codec.name))
return engine_codec;
}
@ -2420,10 +2405,10 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
frame_source_(1280, 720, rtc::kNumMicrosecsPerSec / 30),
last_ssrc_(0) {}
void SetUp() override {
AddSupportedVideoCodecType("VP8");
AddSupportedVideoCodecType("VP9");
encoder_factory_->AddSupportedVideoCodecType("VP8");
encoder_factory_->AddSupportedVideoCodecType("VP9");
#if defined(WEBRTC_USE_H264)
AddSupportedVideoCodecType("H264");
encoder_factory_->AddSupportedVideoCodecType("H264");
#endif
fake_call_.reset(new FakeCall());
@ -2432,8 +2417,8 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
webrtc::CryptoOptions(), video_bitrate_allocator_factory_.get()));
channel_->OnReadyToSend(true);
last_ssrc_ = 123;
send_parameters_.codecs = engine_.send_codecs();
recv_parameters_.codecs = engine_.recv_codecs();
send_parameters_.codecs = engine_.codecs();
recv_parameters_.codecs = engine_.codecs();
ASSERT_TRUE(channel_->SetSendParameters(send_parameters_));
}
@ -2605,7 +2590,7 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
VerifyCodecHasDefaultFeedbackParams(default_codec_, expect_lntf_enabled);
cricket::VideoSendParameters parameters;
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
EXPECT_TRUE(channel_->SetSend(true));
@ -2750,7 +2735,7 @@ TEST_F(WebRtcVideoChannelTest, SetsSyncGroupFromSyncLabel) {
TEST_F(WebRtcVideoChannelTest, RecvStreamWithSimAndRtx) {
cricket::VideoSendParameters parameters;
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
EXPECT_TRUE(channel_->SetSend(true));
parameters.conference_mode = true;
@ -3063,7 +3048,7 @@ TEST_F(WebRtcVideoChannelTest, TransportCcCanBeEnabledAndDisabled) {
// Verify that transport cc feedback is turned on when setting default codecs
// since the default codecs have transport cc feedback enabled.
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
stream = fake_call_->GetVideoReceiveStreams()[0];
EXPECT_TRUE(stream->GetConfig().rtp.transport_cc);
@ -3092,7 +3077,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationCanBeEnabledAndDisabled) {
{
cricket::VideoSendParameters parameters;
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
EXPECT_TRUE(channel_->SetSend(true));
}
@ -3116,7 +3101,7 @@ TEST_F(WebRtcVideoChannelTest, LossNotificationCanBeEnabledAndDisabled) {
EXPECT_FALSE(send_stream->GetConfig().rtp.lntf.enabled);
// Setting the default codecs again, including VP8, turns LNTF back on.
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
recv_stream = fake_call_->GetVideoReceiveStreams()[0];
EXPECT_TRUE(recv_stream->GetConfig().rtp.lntf.enabled);
@ -3129,7 +3114,7 @@ TEST_F(WebRtcVideoChannelTest, NackIsEnabledByDefault) {
VerifyCodecHasDefaultFeedbackParams(default_codec_, false);
cricket::VideoSendParameters parameters;
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
EXPECT_TRUE(channel_->SetSend(true));
@ -3167,7 +3152,7 @@ TEST_F(WebRtcVideoChannelTest, NackCanBeEnabledAndDisabled) {
// Verify that NACK is turned on when setting default codecs since the
// default codecs have NACK enabled.
parameters.codecs = engine_.send_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetSendParameters(parameters));
recv_stream = fake_call_->GetVideoReceiveStreams()[0];
EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0);
@ -3905,7 +3890,7 @@ TEST_F(WebRtcVideoChannelTest, SetDefaultSendCodecs) {
VideoCodec codec;
EXPECT_TRUE(channel_->GetSendCodec(&codec));
EXPECT_TRUE(codec.Matches(engine_.send_codecs()[0]));
EXPECT_TRUE(codec.Matches(engine_.codecs()[0]));
// Using a RTX setup to verify that the default RTX payload type is good.
const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1);
@ -4253,7 +4238,7 @@ TEST_F(WebRtcVideoChannelFlexfecRecvTest,
TEST_F(WebRtcVideoChannelTest,
SetSendCodecRejectsRtxWithoutAssociatedPayloadType) {
const int kUnusedPayloadType = 127;
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType));
cricket::VideoSendParameters parameters;
cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx");
@ -4266,8 +4251,8 @@ TEST_F(WebRtcVideoChannelTest,
SetSendCodecRejectsRtxWithoutMatchingVideoCodec) {
const int kUnusedPayloadType1 = 126;
const int kUnusedPayloadType2 = 127;
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType2));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType2));
{
cricket::VideoCodec rtx_codec = cricket::VideoCodec::CreateRtxCodec(
kUnusedPayloadType1, GetEngineCodec("VP8").id);
@ -4290,8 +4275,8 @@ TEST_F(WebRtcVideoChannelTest,
TEST_F(WebRtcVideoChannelTest, SetSendCodecsWithChangedRtxPayloadType) {
const int kUnusedPayloadType1 = 126;
const int kUnusedPayloadType2 = 127;
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.send_codecs(), kUnusedPayloadType2));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType2));
// SSRCs for RTX.
cricket::StreamParams params =
@ -4692,8 +4677,8 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithOnlyVp8) {
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithRtx) {
const int kUnusedPayloadType1 = 126;
const int kUnusedPayloadType2 = 127;
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kUnusedPayloadType2));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType2));
cricket::VideoRecvParameters parameters;
parameters.codecs.push_back(GetEngineCodec("VP8"));
@ -4791,8 +4776,8 @@ TEST_F(WebRtcVideoChannelTest, DuplicateRedCodecIsDropped) {
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsWithChangedRtxPayloadType) {
const int kUnusedPayloadType1 = 126;
const int kUnusedPayloadType2 = 127;
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kUnusedPayloadType2));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType1));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType2));
// SSRCs for RTX.
cricket::StreamParams params =
@ -4840,14 +4825,13 @@ TEST_F(WebRtcVideoChannelTest, SetRecvCodecsDifferentPayloadType) {
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsAcceptDefaultCodecs) {
cricket::VideoRecvParameters parameters;
parameters.codecs = engine_.recv_codecs();
parameters.codecs = engine_.codecs();
EXPECT_TRUE(channel_->SetRecvParameters(parameters));
FakeVideoReceiveStream* stream = AddRecvStream();
const webrtc::VideoReceiveStream::Config& config = stream->GetConfig();
EXPECT_EQ(engine_.recv_codecs()[0].name,
config.decoders[0].video_format.name);
EXPECT_EQ(engine_.recv_codecs()[0].id, config.decoders[0].payload_type);
EXPECT_EQ(engine_.codecs()[0].name, config.decoders[0].video_format.name);
EXPECT_EQ(engine_.codecs()[0].id, config.decoders[0].payload_type);
}
TEST_F(WebRtcVideoChannelTest, SetRecvCodecsRejectUnsupportedCodec) {
@ -5737,7 +5721,7 @@ void WebRtcVideoChannelTest::TestReceiveUnsignaledSsrcPacket(
uint8_t payload_type,
bool expect_created_receive_stream) {
// kRedRtxPayloadType must currently be unused.
EXPECT_FALSE(FindCodecById(engine_.recv_codecs(), kRedRtxPayloadType));
EXPECT_FALSE(FindCodecById(engine_.codecs(), kRedRtxPayloadType));
// Add a RED RTX codec.
VideoCodec red_rtx_codec =
@ -7594,7 +7578,6 @@ class WebRtcVideoChannelSimulcastTest : public ::testing::Test {
void SetUp() override {
encoder_factory_->AddSupportedVideoCodecType("VP8");
decoder_factory_->AddSupportedVideoCodecType("VP8");
channel_.reset(engine_.CreateMediaChannel(
&fake_call_, GetMediaConfig(), VideoOptions(), webrtc::CryptoOptions(),
mock_rate_allocator_factory_.get()));