Bug 1521169 - Rename SimulcastEncoding to Encoding in VideoCodecConfig; r=pehrsons

The Transceivers code just calls these encodings, and we use them even if we're
not doing simulcast, so we should just call them encodings as well.

Differential Revision: https://phabricator.services.mozilla.com/D24548

--HG--
extra : rebase_source : e25e4b4154d5a92395d6e81c86c7e165e18e583e
This commit is contained in:
Dan Minor 2019-02-21 13:15:48 -05:00
Родитель 1df7bb0339
Коммит 6d0a463689
6 изменённых файлов: 119 добавлений и 122 удалений

Просмотреть файл

@ -436,8 +436,8 @@ class TransportConduitTest : public ::testing::Test {
// Same APIs
mozilla::EncodingConstraints constraints;
mozilla::VideoCodecConfig cinst1(120, "VP8", constraints);
VideoCodecConfig::SimulcastEncoding encoding;
cinst1.mSimulcastEncodings.push_back(encoding);
VideoCodecConfig::Encoding encoding;
cinst1.mEncodings.push_back(encoding);
// This test is disabled because with the current code this will trigger an
// assertion in video_receive_stream.cc because we this results in a
@ -448,7 +448,7 @@ class TransportConduitTest : public ::testing::Test {
cerr << " *************************************************" << endl;
mozilla::VideoCodecConfig cinst2(120, "VP8", constraints);
cinst2.mSimulcastEncodings.push_back(encoding);
cinst2.mEncodings.push_back(encoding);
rcvCodecList.push_back(&cinst1);
rcvCodecList.push_back(&cinst2);
err = videoSession->ConfigureRecvMediaCodecs(rcvCodecList);
@ -468,9 +468,9 @@ class TransportConduitTest : public ::testing::Test {
mozilla::VideoCodecConfig cinst3(
124, "I4201234tttttthhhyyyy89087987y76t567r7756765rr6u6676",
constraints);
cinst3.mSimulcastEncodings.push_back(encoding);
cinst3.mEncodings.push_back(encoding);
mozilla::VideoCodecConfig cinst4(124, "", constraints);
cinst4.mSimulcastEncodings.push_back(encoding);
cinst4.mEncodings.push_back(encoding);
rcvCodecList.emplace_back(new mozilla::VideoCodecConfig(cinst3));
rcvCodecList.emplace_back(new mozilla::VideoCodecConfig(cinst4));

Просмотреть файл

@ -307,11 +307,11 @@ TEST_F(VideoConduitTest, TestConfigureReceiveMediaCodecsTmmbr) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodec) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
// defaults
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -355,11 +355,11 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodec) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxFps) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
constraints.maxFps = 0;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -371,7 +371,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxFps) {
constraints.maxFps = 42;
VideoCodecConfig codecConfig2(120, "VP8", constraints);
codecConfig2.mSimulcastEncodings.push_back(encoding);
codecConfig2.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig2);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -384,11 +384,11 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxFps) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxMbps) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
constraints.maxMbps = 0;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -401,7 +401,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxMbps) {
constraints.maxMbps = 10000;
VideoCodecConfig codecConfig2(120, "VP8", constraints);
codecConfig2.mSimulcastEncodings.push_back(encoding);
codecConfig2.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig2);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -415,11 +415,11 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxMbps) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecDefaults) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -442,12 +442,12 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecDefaults) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecTias) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
// TIAS
VideoCodecConfig codecConfigTias(120, "VP8", constraints);
codecConfigTias.mSimulcastEncodings.push_back(encoding);
codecConfigTias.mEncodings.push_back(encoding);
codecConfigTias.mTias = 1000000;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigTias);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -462,7 +462,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecTias) {
// TIAS (too low)
VideoCodecConfig codecConfigTiasLow(120, "VP8", constraints);
codecConfigTiasLow.mSimulcastEncodings.push_back(encoding);
codecConfigTiasLow.mEncodings.push_back(encoding);
codecConfigTiasLow.mTias = 1000;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigTiasLow);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -479,12 +479,12 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecTias) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxBr) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
encoding.constraints.maxBr = 50000;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -500,7 +500,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecMaxBr) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecScaleResolutionBy) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
std::vector<unsigned int> ssrcs = {42, 1729};
@ -508,9 +508,9 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecScaleResolutionBy) {
VideoCodecConfig codecConfig(120, "VP8", constraints);
encoding.constraints.scaleDownBy = 2;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
encoding.constraints.scaleDownBy = 4;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -533,13 +533,13 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecScaleResolutionBy) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecCodecMode) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
mVideoConduit->ConfigureCodecMode(webrtc::VideoCodecMode::kScreensharing);
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -551,13 +551,13 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecCodecMode) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecFEC) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
WebrtcGmpPCHandleSetter setter("hi there");
// H264 + FEC
VideoCodecConfig codecConfig(120, "H264", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
codecConfig.mFECFbSet = true;
codecConfig.mULPFECPayloadType = 1;
codecConfig.mREDPayloadType = 2;
@ -589,7 +589,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecFEC) {
// VP8 + FEC + Nack
VideoCodecConfig codecConfig2(120, "VP8", constraints);
codecConfig2.mSimulcastEncodings.push_back(encoding);
codecConfig2.mEncodings.push_back(encoding);
codecConfig2.mFECFbSet = true;
codecConfig2.mNackFbTypes.push_back("");
codecConfig2.mULPFECPayloadType = 1;
@ -610,10 +610,10 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecFEC) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecNack) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -631,10 +631,10 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecNack) {
TEST_F(VideoConduitTest, TestConfigureSendMediaCodecRids) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -644,11 +644,11 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecRids) {
std::vector<unsigned int> ssrcs = {42, 1729};
mVideoConduit->SetLocalSSRCs(ssrcs);
codecConfig.mSimulcastEncodings.clear();
codecConfig.mEncodings.clear();
encoding.rid = "1";
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
encoding.rid = "2";
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -665,9 +665,9 @@ TEST_F(VideoConduitTest, TestOnSinkWantsChanged) {
wants.max_pixel_count = 256000;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
std::vector<webrtc::VideoStream> videoStreams;
codecConfig.mEncodingConstraints.maxFs = 0;
@ -727,16 +727,16 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastOddScreen) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::SimulcastEncoding encoding2;
VideoCodecConfig::SimulcastEncoding encoding3;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig::Encoding encoding2;
VideoCodecConfig::Encoding encoding3;
encoding2.constraints.scaleDownBy = 2;
encoding3.constraints.scaleDownBy = 4;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mSimulcastEncodings.push_back(encoding2);
codecConfig.mSimulcastEncodings.push_back(encoding3);
codecConfig.mEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding2);
codecConfig.mEncodings.push_back(encoding3);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -759,8 +759,8 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastOddScreen) {
EXPECT_EQ(videoStreams[0].height, 4U);
// Test that we are able to remove the 16-alignment cropping (non-simulcast)
codecConfig.mSimulcastEncodings.clear();
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.clear();
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
mVideoConduit->SetLocalSSRCs({42});
ASSERT_EQ(ec, kMediaConduitNoError);
@ -780,17 +780,17 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastAllScaling) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::SimulcastEncoding encoding2;
VideoCodecConfig::SimulcastEncoding encoding3;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig::Encoding encoding2;
VideoCodecConfig::Encoding encoding3;
encoding.constraints.scaleDownBy = 2;
encoding2.constraints.scaleDownBy = 4;
encoding3.constraints.scaleDownBy = 6;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mSimulcastEncodings.push_back(encoding2);
codecConfig.mSimulcastEncodings.push_back(encoding3);
codecConfig.mEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding2);
codecConfig.mEncodings.push_back(encoding3);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -834,9 +834,9 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastAllScaling) {
EXPECT_EQ(videoStreams[0].width, 160U);
EXPECT_EQ(videoStreams[0].height, 88U);
codecConfig.mSimulcastEncodings[0].constraints.scaleDownBy = 1;
codecConfig.mSimulcastEncodings[1].constraints.scaleDownBy = 2;
codecConfig.mSimulcastEncodings[2].constraints.scaleDownBy = 4;
codecConfig.mEncodings[0].constraints.scaleDownBy = 1;
codecConfig.mEncodings[1].constraints.scaleDownBy = 2;
codecConfig.mEncodings[2].constraints.scaleDownBy = 4;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
SendVideoFrame(1280, 720, 4);
@ -859,16 +859,16 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastScreenshare) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::SimulcastEncoding encoding2;
VideoCodecConfig::SimulcastEncoding encoding3;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig::Encoding encoding2;
VideoCodecConfig::Encoding encoding3;
encoding2.constraints.scaleDownBy = 2;
encoding3.constraints.scaleDownBy = 4;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mSimulcastEncodings.push_back(encoding2);
codecConfig.mSimulcastEncodings.push_back(encoding3);
codecConfig.mEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding2);
codecConfig.mEncodings.push_back(encoding3);
ec =
mVideoConduit->ConfigureCodecMode(webrtc::VideoCodecMode::kScreensharing);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -884,7 +884,7 @@ TEST_F(VideoConduitTest, TestConfigureSendMediaCodecSimulcastScreenshare) {
TEST_F(VideoConduitTest, TestReconfigureReceiveMediaCodecs) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<UniquePtr<mozilla::VideoCodecConfig>> codecs;
WebrtcGmpPCHandleSetter setter("hi there");
@ -1041,13 +1041,13 @@ TEST_F(VideoConduitTest, TestReconfigureReceiveMediaCodecs) {
TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
WebrtcGmpPCHandleSetter setter("hi there");
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1074,7 +1074,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
// FEC
VideoCodecConfig codecConfigFEC(120, "VP8", constraints);
codecConfigFEC.mSimulcastEncodings.push_back(encoding);
codecConfigFEC.mEncodings.push_back(encoding);
codecConfigFEC.mFECFbSet = true;
codecConfigFEC.mNackFbTypes.push_back("");
codecConfigFEC.mULPFECPayloadType = 1;
@ -1093,7 +1093,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
// H264
VideoCodecConfig codecConfigH264(120, "H264", constraints);
codecConfigH264.mSimulcastEncodings.push_back(encoding);
codecConfigH264.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigH264);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -1103,7 +1103,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
// TIAS
VideoCodecConfig codecConfigTias(120, "VP8", constraints);
codecConfigTias.mSimulcastEncodings.push_back(encoding);
codecConfigTias.mEncodings.push_back(encoding);
codecConfigTias.mTias = 1000000;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigTias);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1120,7 +1120,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
// MaxBr
VideoCodecConfig codecConfigMaxBr(120, "VP8", constraints);
encoding.constraints.maxBr = 50000;
codecConfigMaxBr.mSimulcastEncodings.push_back(encoding);
codecConfigMaxBr.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigMaxBr);
ASSERT_EQ(ec, kMediaConduitNoError);
mVideoConduit->StartTransmitting();
@ -1136,7 +1136,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
VideoCodecConfig codecConfigMaxFs(120, "VP8", constraints);
codecConfigMaxFs.mEncodingConstraints.maxFs = 3600;
encoding.constraints.maxBr = 0;
codecConfigMaxFs.mSimulcastEncodings.push_back(encoding);
codecConfigMaxFs.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigMaxFs);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1168,13 +1168,13 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodec) {
TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
WebrtcGmpPCHandleSetter setter("hi there");
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1203,7 +1203,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
// TIAS
VideoCodecConfig codecConfigTias(120, "VP8", constraints);
codecConfigTias.mSimulcastEncodings.push_back(encoding);
codecConfigTias.mEncodings.push_back(encoding);
codecConfigTias.mTias = 1000000;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigTias);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1218,7 +1218,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
// MaxBr
VideoCodecConfig codecConfigMaxBr(120, "VP8", constraints);
encoding.constraints.maxBr = 50000;
codecConfigMaxBr.mSimulcastEncodings.push_back(encoding);
codecConfigMaxBr.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigMaxBr);
ASSERT_EQ(ec, kMediaConduitNoError);
SendVideoFrame(1280, 720, 1);
@ -1232,7 +1232,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
VideoCodecConfig codecConfigMaxFs(120, "VP8", constraints);
codecConfigMaxFs.mEncodingConstraints.maxFs = 3600;
encoding.constraints.maxBr = 0;
codecConfigMaxFs.mSimulcastEncodings.push_back(encoding);
codecConfigMaxFs.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigMaxFs);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1262,7 +1262,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
VideoCodecConfig codecConfigScaleDownBy(120, "VP8", constraints);
encoding.constraints.maxFs = 0;
encoding.constraints.scaleDownBy = 3.7;
codecConfigScaleDownBy.mSimulcastEncodings.push_back(encoding);
codecConfigScaleDownBy.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigScaleDownBy);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1272,7 +1272,7 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
ASSERT_EQ(sink->mVideoFrame.timestamp_us(), 4000U);
ASSERT_EQ(sink->mOnFrameCount, 4U);
codecConfigScaleDownBy.mSimulcastEncodings[0].constraints.scaleDownBy = 1.3;
codecConfigScaleDownBy.mEncodings[0].constraints.scaleDownBy = 1.3;
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfigScaleDownBy);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1288,11 +1288,11 @@ TEST_F(VideoConduitTest, TestReconfigureSendMediaCodecWhileTransmitting) {
TEST_F(VideoConduitTest, TestVideoEncode) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1326,12 +1326,12 @@ TEST_F(VideoConduitTest, TestVideoEncode) {
TEST_F(VideoConduitTest, TestVideoEncodeMaxFs) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mEncodingConstraints.maxFs = 3600;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1389,13 +1389,13 @@ TEST_F(VideoConduitTest, TestVideoEncodeMaxFs) {
TEST_F(VideoConduitTest, DISABLED_TestVideoEncodeMaxWidthAndHeight) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mEncodingConstraints.maxWidth = 1280;
codecConfig.mEncodingConstraints.maxHeight = 720;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1429,13 +1429,13 @@ TEST_F(VideoConduitTest, DISABLED_TestVideoEncodeMaxWidthAndHeight) {
TEST_F(VideoConduitTest, TestVideoEncodeScaleResolutionBy) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
encoding.constraints.scaleDownBy = 2;
std::vector<webrtc::VideoStream> videoStreams;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mEncodingConstraints.maxFs = 3600;
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);
@ -1465,17 +1465,17 @@ TEST_F(VideoConduitTest, TestVideoEncodeSimulcastScaleResolutionBy) {
MediaConduitErrorCode ec;
EncodingConstraints constraints;
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::SimulcastEncoding encoding2;
VideoCodecConfig::SimulcastEncoding encoding3;
VideoCodecConfig::Encoding encoding;
VideoCodecConfig::Encoding encoding2;
VideoCodecConfig::Encoding encoding3;
encoding.constraints.scaleDownBy = 2;
encoding2.constraints.scaleDownBy = 3;
encoding3.constraints.scaleDownBy = 4;
VideoCodecConfig codecConfig(120, "VP8", constraints);
codecConfig.mSimulcastEncodings.push_back(encoding);
codecConfig.mSimulcastEncodings.push_back(encoding2);
codecConfig.mSimulcastEncodings.push_back(encoding3);
codecConfig.mEncodings.push_back(encoding);
codecConfig.mEncodings.push_back(encoding2);
codecConfig.mEncodings.push_back(encoding3);
ec = mVideoConduit->ConfigureSendMediaCodec(&codecConfig);
ASSERT_EQ(ec, kMediaConduitNoError);

Просмотреть файл

@ -82,14 +82,14 @@ class VideoCodecConfig {
uint32_t mTias;
EncodingConstraints mEncodingConstraints;
struct SimulcastEncoding {
struct Encoding {
std::string rid;
EncodingConstraints constraints;
bool operator==(const SimulcastEncoding& aOther) const {
bool operator==(const Encoding& aOther) const {
return rid == aOther.rid && constraints == aOther.constraints;
}
};
std::vector<SimulcastEncoding> mSimulcastEncodings;
std::vector<Encoding> mEncodings;
std::string mSpropParameterSets;
uint8_t mProfile;
uint8_t mConstraints;
@ -106,7 +106,7 @@ class VideoCodecConfig {
mREDPayloadType != aRhs.mREDPayloadType ||
mREDRTXPayloadType != aRhs.mREDRTXPayloadType || mTias != aRhs.mTias ||
!(mEncodingConstraints == aRhs.mEncodingConstraints) ||
!(mSimulcastEncodings == aRhs.mSimulcastEncodings) ||
!(mEncodings == aRhs.mEncodings) ||
mSpropParameterSets != aRhs.mSpropParameterSets ||
mProfile != aRhs.mProfile || mConstraints != aRhs.mConstraints ||
mLevel != aRhs.mLevel ||
@ -143,12 +143,12 @@ class VideoCodecConfig {
}
bool ResolutionEquals(const VideoCodecConfig& aConfig) const {
if (mSimulcastEncodings.size() != aConfig.mSimulcastEncodings.size()) {
if (mEncodings.size() != aConfig.mEncodings.size()) {
return false;
}
for (size_t i = 0; i < mSimulcastEncodings.size(); ++i) {
if (!mSimulcastEncodings[i].constraints.ResolutionEquals(
aConfig.mSimulcastEncodings[i].constraints)) {
for (size_t i = 0; i < mEncodings.size(); ++i) {
if (!mEncodings[i].constraints.ResolutionEquals(
aConfig.mEncodings[i].constraints)) {
return false;
}
}

Просмотреть файл

@ -691,8 +691,7 @@ ConfigureVideoEncoderSettings(const VideoCodecConfig* aConfig,
bool is_screencast =
aConduit->CodecMode() == webrtc::VideoCodecMode::kScreensharing;
// No automatic resizing when using simulcast or screencast.
bool automatic_resize =
!is_screencast && aConfig->mSimulcastEncodings.size() <= 1;
bool automatic_resize = !is_screencast && aConfig->mEncodings.size() <= 1;
bool frame_dropping = !is_screencast;
bool denoising;
bool codec_default_denoising = false;
@ -787,8 +786,9 @@ MediaConduitErrorCode WebrtcVideoConduit::ConfigureSendMediaCodec(
return condError;
}
size_t streamCount = std::min(codecConfig->mSimulcastEncodings.size(),
size_t streamCount = std::min(codecConfig->mEncodings.size(),
(size_t)webrtc::kMaxSimulcastStreams);
CSFLogDebug(LOGTAG, "%s for VideoConduit:%p stream count:%zu", __FUNCTION__,
this, streamCount);
@ -833,10 +833,9 @@ MediaConduitErrorCode WebrtcVideoConduit::ConfigureSendMediaCodec(
mVideoAdapter = MakeUnique<cricket::VideoAdapter>(
streamCount > 1 ? SIMULCAST_RESOLUTION_ALIGNMENT : 1);
mVideoAdapter->OnScaleResolutionBy(
(streamCount >= 1 &&
codecConfig->mSimulcastEncodings[0].constraints.scaleDownBy > 1.0)
codecConfig->mEncodings[0].constraints.scaleDownBy > 1.0
? rtc::Optional<float>(
codecConfig->mSimulcastEncodings[0].constraints.scaleDownBy)
codecConfig->mEncodings[0].constraints.scaleDownBy)
: rtc::Optional<float>());
// XXX parse the encoded SPS/PPS data and set spsData/spsLen/ppsData/ppsLen
@ -860,8 +859,7 @@ MediaConduitErrorCode WebrtcVideoConduit::ConfigureSendMediaCodec(
mActiveCodecMode == mCodecMode) {
mCurSendCodecConfig->mEncodingConstraints =
codecConfig->mEncodingConstraints;
mCurSendCodecConfig->mSimulcastEncodings =
codecConfig->mSimulcastEncodings;
mCurSendCodecConfig->mEncodings = codecConfig->mEncodings;
mSendStream->ReconfigureVideoEncoder(mEncoderConfig.CopyConfig());
return kMediaConduitNoError;
}
@ -906,17 +904,16 @@ MediaConduitErrorCode WebrtcVideoConduit::ConfigureSendMediaCodec(
mSendStreamConfig.rtp.rids.clear();
bool has_rid = false;
for (size_t idx = 0; idx < streamCount; idx++) {
auto& simulcastEncoding = mCurSendCodecConfig->mSimulcastEncodings[idx];
if (simulcastEncoding.rid[0]) {
auto& encoding = mCurSendCodecConfig->mEncodings[idx];
if (encoding.rid[0]) {
has_rid = true;
break;
}
}
if (has_rid) {
for (size_t idx = streamCount; idx > 0; idx--) {
auto& simulcastEncoding =
mCurSendCodecConfig->mSimulcastEncodings[idx - 1];
mSendStreamConfig.rtp.rids.push_back(simulcastEncoding.rid);
auto& encoding = mCurSendCodecConfig->mEncodings[idx - 1];
mSendStreamConfig.rtp.rids.push_back(encoding.rid);
}
}

Просмотреть файл

@ -141,8 +141,8 @@ std::vector<webrtc::VideoStream> VideoStreamFactory::CreateEncoderStreams(
for (size_t idx = streamCount - 1; streamCount > 0; idx--, streamCount--) {
webrtc::VideoStream video_stream;
auto& simulcastEncoding = mCodecConfig.mSimulcastEncodings[idx];
MOZ_ASSERT(simulcastEncoding.constraints.scaleDownBy >= 1.0);
auto& encoding = mCodecConfig.mEncodings[idx];
MOZ_ASSERT(encoding.constraints.scaleDownBy >= 1.0);
// All streams' dimensions must retain the aspect ratio of the input stream.
// Note that the first stream might already have been scaled by us.
@ -157,8 +157,8 @@ std::vector<webrtc::VideoStream> VideoStreamFactory::CreateEncoderStreams(
outHeight = height;
} else {
float effectiveScaleDownBy =
simulcastEncoding.constraints.scaleDownBy /
mCodecConfig.mSimulcastEncodings[0].constraints.scaleDownBy;
encoding.constraints.scaleDownBy /
mCodecConfig.mEncodings[0].constraints.scaleDownBy;
MOZ_ASSERT(effectiveScaleDownBy >= 1.0);
mSimulcastAdapter->OnScaleResolutionBy(
effectiveScaleDownBy > 1.0
@ -181,7 +181,7 @@ std::vector<webrtc::VideoStream> VideoStreamFactory::CreateEncoderStreams(
if (outWidth == 0 || outHeight == 0) {
CSFLogInfo(LOGTAG,
"%s Stream with RID %s ignored because of no resolution.",
__FUNCTION__, simulcastEncoding.rid.c_str());
__FUNCTION__, encoding.rid.c_str());
continue;
}
@ -191,13 +191,13 @@ std::vector<webrtc::VideoStream> VideoStreamFactory::CreateEncoderStreams(
video_stream.height = outHeight;
CSFLogInfo(LOGTAG, "%s Input frame %ux%u, RID %s scaling to %zux%zu",
__FUNCTION__, width, height, simulcastEncoding.rid.c_str(),
__FUNCTION__, width, height, encoding.rid.c_str(),
video_stream.width, video_stream.height);
if (video_stream.width * height != width * video_stream.height) {
CSFLogInfo(LOGTAG,
"%s Stream with RID %s ignored because of bad aspect ratio.",
__FUNCTION__, simulcastEncoding.rid.c_str());
__FUNCTION__, encoding.rid.c_str());
continue;
}
@ -205,11 +205,11 @@ std::vector<webrtc::VideoStream> VideoStreamFactory::CreateEncoderStreams(
video_stream.max_framerate = mSendingFramerate;
SelectBitrates(video_stream.width, video_stream.height, mMinBitrate,
mStartBitrate, simulcastEncoding.constraints.maxBr,
mPrefMaxBitrate, mNegotiatedMaxBitrate, video_stream);
mStartBitrate, encoding.constraints.maxBr, mPrefMaxBitrate,
mNegotiatedMaxBitrate, video_stream);
video_stream.max_qp = kQpMax;
video_stream.SetRid(simulcastEncoding.rid);
video_stream.SetRid(encoding.rid);
// leave vector temporal_layer_thresholds_bps empty for non-simulcast
video_stream.temporal_layer_thresholds_bps.clear();

Просмотреть файл

@ -787,10 +787,10 @@ static nsresult NegotiatedDetailsToVideoCodecConfigs(
for (size_t i = 0; i < aDetails.GetEncodingCount(); ++i) {
const JsepTrackEncoding& jsepEncoding(aDetails.GetEncoding(i));
if (jsepEncoding.HasFormat(codec->mDefaultPt)) {
VideoCodecConfig::SimulcastEncoding encoding;
VideoCodecConfig::Encoding encoding;
encoding.rid = jsepEncoding.mRid;
encoding.constraints = jsepEncoding.mConstraints;
config->mSimulcastEncodings.push_back(encoding);
config->mEncodings.push_back(encoding);
}
}