diff --git a/api/video_codecs/sdp_video_format.cc b/api/video_codecs/sdp_video_format.cc index 08dfed4ce5..7921064c0f 100644 --- a/api/video_codecs/sdp_video_format.cc +++ b/api/video_codecs/sdp_video_format.cc @@ -192,6 +192,60 @@ bool operator==(const SdpVideoFormat& a, const SdpVideoFormat& b) { a.scalability_modes == b.scalability_modes; } +const SdpVideoFormat SdpVideoFormat::VP8() { + return SdpVideoFormat(cricket::kVp8CodecName, {}); +} + +const SdpVideoFormat SdpVideoFormat::H264() { + // H264 will typically require more tweaking like setting + // * packetization-mode (which defaults to 0 but 1 is more common) + // * level-asymmetry-allowed (which defaults to 0 but 1 is more common) + // * profile-level-id of which there are many. + return SdpVideoFormat(cricket::kH264CodecName, {}); +} + +const SdpVideoFormat SdpVideoFormat::VP9Profile0() { + return SdpVideoFormat( + cricket::kVp9CodecName, + {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}}); +} + +const SdpVideoFormat SdpVideoFormat::VP9Profile1() { + return SdpVideoFormat( + cricket::kVp9CodecName, + {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile1)}}); +} + +const SdpVideoFormat SdpVideoFormat::VP9Profile2() { + return SdpVideoFormat( + cricket::kVp9CodecName, + {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile2)}}); +} + +const SdpVideoFormat SdpVideoFormat::VP9Profile3() { + return SdpVideoFormat( + cricket::kVp9CodecName, + {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile3)}}); +} + +const SdpVideoFormat SdpVideoFormat::AV1Profile0() { + // https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters + return SdpVideoFormat(cricket::kAv1CodecName, + {{cricket::kAv1FmtpProfile, + AV1ProfileToString(AV1Profile::kProfile0).data()}, + {cricket::kAv1FmtpLevelIdx, "5"}, + {cricket::kAv1FmtpTier, "0"}}); +} + +const SdpVideoFormat SdpVideoFormat::AV1Profile1() { + // https://aomediacodec.github.io/av1-rtp-spec/#72-sdp-parameters + return SdpVideoFormat(cricket::kAv1CodecName, + {{cricket::kAv1FmtpProfile, + AV1ProfileToString(AV1Profile::kProfile1).data()}, + {cricket::kAv1FmtpLevelIdx, "5"}, + {cricket::kAv1FmtpTier, "0"}}); +} + absl::optional FuzzyMatchSdpVideoFormat( rtc::ArrayView supported_formats, const SdpVideoFormat& format) { diff --git a/api/video_codecs/sdp_video_format.h b/api/video_codecs/sdp_video_format.h index af9537b5a3..b8c997e6c6 100644 --- a/api/video_codecs/sdp_video_format.h +++ b/api/video_codecs/sdp_video_format.h @@ -62,6 +62,16 @@ struct RTC_EXPORT SdpVideoFormat { std::string name; CodecParameterMap parameters; absl::InlinedVector scalability_modes; + + // Well-known video codecs and their format parameters. + static const SdpVideoFormat VP8(); + static const SdpVideoFormat H264(); + static const SdpVideoFormat VP9Profile0(); + static const SdpVideoFormat VP9Profile1(); + static const SdpVideoFormat VP9Profile2(); + static const SdpVideoFormat VP9Profile3(); + static const SdpVideoFormat AV1Profile0(); + static const SdpVideoFormat AV1Profile1(); }; // For not so good reasons sometimes additional parameters are added to an diff --git a/api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h b/api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h index 2f4beda6ab..a86a45813f 100644 --- a/api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h +++ b/api/video_codecs/video_decoder_factory_template_libvpx_vp8_adapter.h @@ -21,7 +21,7 @@ namespace webrtc { struct LibvpxVp8DecoderTemplateAdapter { static std::vector SupportedFormats() { - return {SdpVideoFormat("VP8")}; + return {SdpVideoFormat::VP8()}; } static std::unique_ptr CreateDecoder( diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc index e3939e1371..476896022e 100644 --- a/call/call_perf_tests.cc +++ b/call/call_perf_tests.cc @@ -1188,7 +1188,7 @@ TEST_F(CallPerfTest, TestEncodeFramerateVp8Simulcast) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestEncodeFramerate(&encoder_factory, "VP8", @@ -1200,7 +1200,7 @@ TEST_F(CallPerfTest, TestEncodeFramerateVp8SimulcastLowerInputFps) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestEncodeFramerate(&encoder_factory, "VP8", diff --git a/media/engine/internal_decoder_factory.cc b/media/engine/internal_decoder_factory.cc index d79cbf2712..33fed924df 100644 --- a/media/engine/internal_decoder_factory.cc +++ b/media/engine/internal_decoder_factory.cc @@ -44,18 +44,15 @@ std::unique_ptr CreateDav1dDecoder() { std::vector InternalDecoderFactory::GetSupportedFormats() const { std::vector formats; - formats.push_back(SdpVideoFormat(cricket::kVp8CodecName)); + formats.push_back(SdpVideoFormat::VP8()); for (const SdpVideoFormat& format : SupportedVP9DecoderCodecs()) formats.push_back(format); for (const SdpVideoFormat& h264_format : SupportedH264DecoderCodecs()) formats.push_back(h264_format); if (kDav1dIsIncluded) { - formats.push_back(SdpVideoFormat(cricket::kAv1CodecName)); - formats.push_back( - SdpVideoFormat(cricket::kAv1CodecName, - {{cricket::kAv1FmtpProfile, - AV1ProfileToString(AV1Profile::kProfile1).data()}})); + formats.push_back(SdpVideoFormat::AV1Profile0()); + formats.push_back(SdpVideoFormat::AV1Profile1()); } return formats; diff --git a/media/engine/internal_decoder_factory_unittest.cc b/media/engine/internal_decoder_factory_unittest.cc index 7debe737f5..27933678cf 100644 --- a/media/engine/internal_decoder_factory_unittest.cc +++ b/media/engine/internal_decoder_factory_unittest.cc @@ -61,27 +61,23 @@ TEST(InternalDecoderFactoryTest, Vp8) { const Environment env = CreateEnvironment(); InternalDecoderFactory factory; std::unique_ptr decoder = - factory.Create(env, SdpVideoFormat(cricket::kVp8CodecName)); + factory.Create(env, SdpVideoFormat::VP8()); EXPECT_TRUE(decoder); } TEST(InternalDecoderFactoryTest, Vp9Profile0) { const Environment env = CreateEnvironment(); InternalDecoderFactory factory; - std::unique_ptr decoder = factory.Create( - env, SdpVideoFormat(cricket::kVp9CodecName, - {{kVP9FmtpProfileId, - VP9ProfileToString(VP9Profile::kProfile0)}})); + std::unique_ptr decoder = + factory.Create(env, SdpVideoFormat::VP9Profile0()); EXPECT_EQ(static_cast(decoder), kVp9Enabled); } TEST(InternalDecoderFactoryTest, Vp9Profile1) { const Environment env = CreateEnvironment(); InternalDecoderFactory factory; - std::unique_ptr decoder = factory.Create( - env, SdpVideoFormat(cricket::kVp9CodecName, - {{kVP9FmtpProfileId, - VP9ProfileToString(VP9Profile::kProfile1)}})); + std::unique_ptr decoder = + factory.Create(env, SdpVideoFormat::VP9Profile1()); EXPECT_EQ(static_cast(decoder), kVp9Enabled); } @@ -89,7 +85,7 @@ TEST(InternalDecoderFactoryTest, H264) { const Environment env = CreateEnvironment(); InternalDecoderFactory factory; std::unique_ptr decoder = - factory.Create(env, SdpVideoFormat(cricket::kH264CodecName)); + factory.Create(env, SdpVideoFormat::H264()); EXPECT_EQ(static_cast(decoder), kH264Enabled); } @@ -99,7 +95,7 @@ TEST(InternalDecoderFactoryTest, Av1Profile0) { if (kDav1dIsIncluded) { EXPECT_THAT(factory.GetSupportedFormats(), Contains(Field(&SdpVideoFormat::name, cricket::kAv1CodecName))); - EXPECT_TRUE(factory.Create(env, SdpVideoFormat(cricket::kAv1CodecName))); + EXPECT_TRUE(factory.Create(env, SdpVideoFormat::AV1Profile0())); } else { EXPECT_THAT( factory.GetSupportedFormats(), @@ -127,53 +123,51 @@ TEST(InternalDecoderFactoryTest, Av1) { TEST(InternalDecoderFactoryTest, Av1Profile1_Dav1dDecoderTrialEnabled) { const Environment env = CreateEnvironment(); InternalDecoderFactory factory; - std::unique_ptr decoder = factory.Create( - env, - SdpVideoFormat(cricket::kAv1CodecName, - {{cricket::kAv1FmtpProfile, - AV1ProfileToString(AV1Profile::kProfile1).data()}})); + std::unique_ptr decoder = + factory.Create(env, SdpVideoFormat::AV1Profile1()); EXPECT_EQ(static_cast(decoder), kDav1dIsIncluded); } TEST(InternalDecoderFactoryTest, QueryCodecSupportNoReferenceScaling) { InternalDecoderFactory factory; - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp8CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP8(), /*reference_scaling=*/false), Support(kSupported)); - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp9CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile0(), /*reference_scaling=*/false), Support(kVp9Enabled ? kSupported : kUnsupported)); - EXPECT_THAT(factory.QueryCodecSupport( - SdpVideoFormat(cricket::kVp9CodecName, - {{kVP9FmtpProfileId, - VP9ProfileToString(VP9Profile::kProfile1)}}), - /*reference_scaling=*/false), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile1(), + /*reference_scaling=*/false), Support(kVp9Enabled ? kSupported : kUnsupported)); #if defined(RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY) - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kAv1CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::AV1Profile0(), /*reference_scaling=*/false), Support(kSupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::AV1Profile1(), + /*reference_scaling=*/false), + Support(kSupported)); + #endif } TEST(InternalDecoderFactoryTest, QueryCodecSupportReferenceScaling) { InternalDecoderFactory factory; // VP9 and AV1 support for spatial layers. - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp9CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile0(), /*reference_scaling=*/true), Support(kVp9Enabled ? kSupported : kUnsupported)); #if defined(RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY) - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kAv1CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::AV1Profile0(), /*reference_scaling=*/true), Support(kSupported)); #endif // Invalid config even though VP8 and H264 are supported. - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kH264CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::H264(), /*reference_scaling=*/true), Support(kUnsupported)); - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp8CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP8(), /*reference_scaling=*/true), Support(kUnsupported)); } diff --git a/media/engine/internal_encoder_factory_unittest.cc b/media/engine/internal_encoder_factory_unittest.cc index b9ca6d88c2..7846bd3489 100644 --- a/media/engine/internal_encoder_factory_unittest.cc +++ b/media/engine/internal_encoder_factory_unittest.cc @@ -48,7 +48,7 @@ MATCHER_P(Support, expected, "") { TEST(InternalEncoderFactoryTest, Vp8) { InternalEncoderFactory factory; std::unique_ptr encoder = - factory.CreateVideoEncoder(SdpVideoFormat(cricket::kVp8CodecName)); + factory.CreateVideoEncoder(SdpVideoFormat::VP8()); EXPECT_TRUE(encoder); } @@ -56,9 +56,7 @@ TEST(InternalEncoderFactoryTest, Vp9Profile0) { InternalEncoderFactory factory; if (kVp9Enabled) { std::unique_ptr encoder = - factory.CreateVideoEncoder(SdpVideoFormat( - cricket::kVp9CodecName, - {{kVP9FmtpProfileId, VP9ProfileToString(VP9Profile::kProfile0)}})); + factory.CreateVideoEncoder(SdpVideoFormat::VP9Profile0()); EXPECT_TRUE(encoder); } else { EXPECT_THAT( @@ -71,7 +69,7 @@ TEST(InternalEncoderFactoryTest, H264) { InternalEncoderFactory factory; if (kH264Enabled) { std::unique_ptr encoder = - factory.CreateVideoEncoder(SdpVideoFormat(cricket::kH264CodecName)); + factory.CreateVideoEncoder(SdpVideoFormat::H264()); EXPECT_TRUE(encoder); } else { EXPECT_THAT( @@ -94,25 +92,20 @@ TEST(InternalEncoderFactoryTest, H265IsNotEnabled) { TEST(InternalEncoderFactoryTest, QueryCodecSupportWithScalabilityMode) { InternalEncoderFactory factory; // VP8 and VP9 supported for singles spatial layers. - EXPECT_THAT( - factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp8CodecName), "L1T2"), - Support(kSupported)); - EXPECT_THAT( - factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp9CodecName), "L1T3"), - Support(kVp9Enabled ? kSupported : kUnsupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP8(), "L1T2"), + Support(kSupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile0(), "L1T3"), + Support(kVp9Enabled ? kSupported : kUnsupported)); // VP9 support for spatial layers. - EXPECT_THAT( - factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp9CodecName), "L3T3"), - Support(kVp9Enabled ? kSupported : kUnsupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile0(), "L3T3"), + Support(kVp9Enabled ? kSupported : kUnsupported)); // Invalid scalability modes even though VP8 and H264 are supported. - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kH264CodecName), - "L2T2"), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::H264(), "L2T2"), + Support(kUnsupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP8(), "L3T3"), Support(kUnsupported)); - EXPECT_THAT( - factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp8CodecName), "L3T3"), - Support(kUnsupported)); } #if defined(RTC_USE_LIBAOM_AV1_ENCODER) @@ -120,32 +113,30 @@ TEST(InternalEncoderFactoryTest, Av1) { InternalEncoderFactory factory; EXPECT_THAT(factory.GetSupportedFormats(), Contains(Field(&SdpVideoFormat::name, cricket::kAv1CodecName))); - EXPECT_TRUE( - factory.CreateVideoEncoder(SdpVideoFormat(cricket::kAv1CodecName))); + EXPECT_TRUE(factory.CreateVideoEncoder(SdpVideoFormat::AV1Profile0())); } TEST(InternalEncoderFactoryTest, QueryCodecSupportNoScalabilityModeAv1) { InternalEncoderFactory factory; - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kAv1CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::AV1Profile0(), /*scalability_mode=*/absl::nullopt), Support(kSupported)); } TEST(InternalEncoderFactoryTest, QueryCodecSupportNoScalabilityMode) { InternalEncoderFactory factory; - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp8CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP8(), /*scalability_mode=*/absl::nullopt), Support(kSupported)); - EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat(cricket::kVp9CodecName), + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::VP9Profile0(), /*scalability_mode=*/absl::nullopt), Support(kVp9Enabled ? kSupported : kUnsupported)); } TEST(InternalEncoderFactoryTest, QueryCodecSupportWithScalabilityModeAv1) { InternalEncoderFactory factory; - EXPECT_THAT( - factory.QueryCodecSupport(SdpVideoFormat(cricket::kAv1CodecName), "L2T1"), - Support(kSupported)); + EXPECT_THAT(factory.QueryCodecSupport(SdpVideoFormat::AV1Profile0(), "L2T1"), + Support(kSupported)); } #endif // defined(RTC_USE_LIBAOM_AV1_ENCODER) diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc index 4abda03e51..c574929ac3 100644 --- a/media/engine/simulcast_encoder_adapter_unittest.cc +++ b/media/engine/simulcast_encoder_adapter_unittest.cc @@ -58,8 +58,7 @@ std::unique_ptr CreateSpecificSimulcastTestFixture( std::make_unique( [internal_encoder_factory]() { return std::make_unique( - internal_encoder_factory, - SdpVideoFormat(cricket::kVp8CodecName)); + internal_encoder_factory, SdpVideoFormat::VP8()); }); std::unique_ptr decoder_factory = std::make_unique( @@ -68,7 +67,7 @@ std::unique_ptr CreateSpecificSimulcastTestFixture( }); return CreateSimulcastTestFixture(std::move(encoder_factory), std::move(decoder_factory), - SdpVideoFormat(cricket::kVp8CodecName)); + SdpVideoFormat::VP8()); } } // namespace @@ -355,8 +354,7 @@ class MockVideoEncoder : public VideoEncoder { std::vector MockVideoEncoderFactory::GetSupportedFormats() const { - std::vector formats = {SdpVideoFormat("VP8")}; - return formats; + return {SdpVideoFormat::VP8()}; } std::unique_ptr MockVideoEncoderFactory::CreateVideoEncoder( diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc index 426471c43e..02ba62879e 100644 --- a/media/engine/webrtc_video_engine_unittest.cc +++ b/media/engine/webrtc_video_engine_unittest.cc @@ -1623,7 +1623,7 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test { const std::vector WebRtcVideoChannelEncodedFrameCallbackTest::kSdpVideoFormats = { - webrtc::SdpVideoFormat("VP8")}; + webrtc::SdpVideoFormat::VP8()}; TEST_F(WebRtcVideoChannelEncodedFrameCallbackTest, SetEncodedFrameBufferFunction_DefaultStream) { @@ -2564,9 +2564,8 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchStrictPreference) { ASSERT_TRUE(codec); EXPECT_EQ("VP8", codec->name); - SendImpl()->RequestEncoderSwitch( - webrtc::SdpVideoFormat("VP9", {{"profile-id", "1"}}), - /*allow_default_fallback=*/false); + SendImpl()->RequestEncoderSwitch(webrtc::SdpVideoFormat::VP9Profile1(), + /*allow_default_fallback=*/false); time_controller_.AdvanceTime(kFrameDuration); // VP9 profile_id=1 is not available. Default fallback is not allowed. Switch @@ -2575,9 +2574,8 @@ TEST_F(WebRtcVideoChannelBaseTest, RequestEncoderSwitchStrictPreference) { ASSERT_TRUE(codec); EXPECT_EQ("VP8", codec->name); - SendImpl()->RequestEncoderSwitch( - webrtc::SdpVideoFormat("VP9", {{"profile-id", "0"}}), - /*allow_default_fallback=*/false); + SendImpl()->RequestEncoderSwitch(webrtc::SdpVideoFormat::VP9Profile0(), + /*allow_default_fallback=*/false); time_controller_.AdvanceTime(kFrameDuration); // VP9 profile_id=0 is available. Switch encoder. @@ -9769,7 +9767,7 @@ TEST_F(WebRtcVideoChannelBaseTest, EncoderSelectorSwitchCodec) { webrtc::MockEncoderSelector encoder_selector; EXPECT_CALL(encoder_selector, OnAvailableBitrate) - .WillRepeatedly(Return(webrtc::SdpVideoFormat("VP9"))); + .WillRepeatedly(Return(webrtc::SdpVideoFormat::VP9Profile0())); send_channel_->SetEncoderSelector(kSsrc, &encoder_selector); time_controller_.AdvanceTime(kFrameDuration); diff --git a/modules/video_coding/codecs/h264/h264_simulcast_unittest.cc b/modules/video_coding/codecs/h264/h264_simulcast_unittest.cc index e191f51f0a..65c1add89f 100644 --- a/modules/video_coding/codecs/h264/h264_simulcast_unittest.cc +++ b/modules/video_coding/codecs/h264/h264_simulcast_unittest.cc @@ -30,7 +30,7 @@ std::unique_ptr CreateSpecificSimulcastTestFixture() { []() { return H264Decoder::Create(); }); return CreateSimulcastTestFixture(std::move(encoder_factory), std::move(decoder_factory), - SdpVideoFormat("H264")); + SdpVideoFormat::H264()); } } // namespace diff --git a/modules/video_coding/codecs/test/videocodec_test_libvpx.cc b/modules/video_coding/codecs/test/videocodec_test_libvpx.cc index 062375bd60..7c6dc6404e 100644 --- a/modules/video_coding/codecs/test/videocodec_test_libvpx.cc +++ b/modules/video_coding/codecs/test/videocodec_test_libvpx.cc @@ -366,7 +366,7 @@ TEST(VideoCodecTestLibvpx, MAYBE_SimulcastVP8) { std::unique_ptr adapted_encoder_factory = std::make_unique([&]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat(cricket::kVp8CodecName)); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); std::unique_ptr internal_decoder_factory( new InternalDecoderFactory()); diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_simulcast_test.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_simulcast_test.cc index 3f13066892..79bcb5e212 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_simulcast_test.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_simulcast_test.cc @@ -32,7 +32,7 @@ std::unique_ptr CreateSpecificSimulcastTestFixture() { }); return CreateSimulcastTestFixture(std::move(encoder_factory), std::move(decoder_factory), - SdpVideoFormat("VP8")); + SdpVideoFormat::VP8()); } } // namespace diff --git a/sdk/objc/unittests/objc_video_decoder_factory_tests.mm b/sdk/objc/unittests/objc_video_decoder_factory_tests.mm index 5b2b401a03..33c5089f2e 100644 --- a/sdk/objc/unittests/objc_video_decoder_factory_tests.mm +++ b/sdk/objc/unittests/objc_video_decoder_factory_tests.mm @@ -52,8 +52,7 @@ id CreateErrorDecoderFactory() { std::unique_ptr GetObjCDecoder( id factory) { webrtc::ObjCVideoDecoderFactory decoder_factory(factory); - return decoder_factory.Create(webrtc::CreateEnvironment(), - webrtc::SdpVideoFormat(cricket::kH264CodecName)); + return decoder_factory.Create(webrtc::CreateEnvironment(), webrtc::SdpVideoFormat::H264()); } #pragma mark - diff --git a/test/fake_vp8_encoder_unittest.cc b/test/fake_vp8_encoder_unittest.cc index e79e8e421b..c068be0f43 100644 --- a/test/fake_vp8_encoder_unittest.cc +++ b/test/fake_vp8_encoder_unittest.cc @@ -35,7 +35,7 @@ std::unique_ptr CreateSpecificSimulcastTestFixture() { []() { return std::make_unique(); }); return CreateSimulcastTestFixture(std::move(encoder_factory), std::move(decoder_factory), - SdpVideoFormat("VP8")); + SdpVideoFormat::VP8()); } } // namespace diff --git a/test/fuzzers/vp8_replay_fuzzer.cc b/test/fuzzers/vp8_replay_fuzzer.cc index 819b9626f9..f831ab7385 100644 --- a/test/fuzzers/vp8_replay_fuzzer.cc +++ b/test/fuzzers/vp8_replay_fuzzer.cc @@ -22,7 +22,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { VideoReceiveStreamInterface::Config vp8_config(&(stream_state->transport)); VideoReceiveStreamInterface::Decoder vp8_decoder; - vp8_decoder.video_format = SdpVideoFormat("VP8"); + vp8_decoder.video_format = SdpVideoFormat::VP8(); vp8_decoder.payload_type = 125; vp8_config.decoders.push_back(std::move(vp8_decoder)); diff --git a/test/fuzzers/vp9_replay_fuzzer.cc b/test/fuzzers/vp9_replay_fuzzer.cc index fc10d9ffc7..6fd1b646a9 100644 --- a/test/fuzzers/vp9_replay_fuzzer.cc +++ b/test/fuzzers/vp9_replay_fuzzer.cc @@ -22,7 +22,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) { VideoReceiveStreamInterface::Config vp9_config(&(stream_state->transport)); VideoReceiveStreamInterface::Decoder vp9_decoder; - vp9_decoder.video_format = SdpVideoFormat("VP9"); + vp9_decoder.video_format = SdpVideoFormat::VP9Profile0(); vp9_decoder.payload_type = 124; vp9_config.decoders.push_back(std::move(vp9_decoder)); diff --git a/test/pc/e2e/peer_connection_quality_test.cc b/test/pc/e2e/peer_connection_quality_test.cc index 3a6b808167..6c58115078 100644 --- a/test/pc/e2e/peer_connection_quality_test.cc +++ b/test/pc/e2e/peer_connection_quality_test.cc @@ -567,14 +567,14 @@ void PeerConnectionE2EQualityTest::SetPeerCodecPreferences(TestPeer* peer) { peer->params().video_codecs, true, peer->params().use_ulp_fec, peer->params().use_flex_fec, peer->pc_factory() - ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) + ->GetRtpReceiverCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) .codecs); std::vector without_rtx_video_capabilities = FilterVideoCodecCapabilities( peer->params().video_codecs, false, peer->params().use_ulp_fec, peer->params().use_flex_fec, peer->pc_factory() - ->GetRtpSenderCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) + ->GetRtpReceiverCapabilities(cricket::MediaType::MEDIA_TYPE_VIDEO) .codecs); // Set codecs for transceivers diff --git a/test/peer_scenario/peer_scenario_client.cc b/test/peer_scenario/peer_scenario_client.cc index 2b84d1598d..fe0c75caea 100644 --- a/test/peer_scenario/peer_scenario_client.cc +++ b/test/peer_scenario/peer_scenario_client.cc @@ -179,7 +179,7 @@ class FakeVideoEncoderFactory : public VideoEncoderFactory { public: FakeVideoEncoderFactory(Clock* clock) : clock_(clock) {} std::vector GetSupportedFormats() const override { - return {SdpVideoFormat("VP8")}; + return {SdpVideoFormat::VP8()}; } std::unique_ptr CreateVideoEncoder( const SdpVideoFormat& format) override { @@ -193,7 +193,7 @@ class FakeVideoEncoderFactory : public VideoEncoderFactory { class FakeVideoDecoderFactory : public VideoDecoderFactory { public: std::vector GetSupportedFormats() const override { - return {SdpVideoFormat("VP8")}; + return {SdpVideoFormat::VP8()}; } std::unique_ptr Create(const Environment& env, const SdpVideoFormat& format) override { diff --git a/test/video_codec_tester.h b/test/video_codec_tester.h index 00b6093dca..1db45d2b55 100644 --- a/test/video_codec_tester.h +++ b/test/video_codec_tester.h @@ -48,7 +48,7 @@ class VideoCodecTester { }; struct EncodingSettings { - SdpVideoFormat sdp_video_format = SdpVideoFormat("VP8"); + SdpVideoFormat sdp_video_format = SdpVideoFormat::VP8(); ScalabilityMode scalability_mode = ScalabilityMode::kL1T1; struct LayerSettings { diff --git a/test/video_codec_tester_unittest.cc b/test/video_codec_tester_unittest.cc index fdd7b37a00..8ad6558dce 100644 --- a/test/video_codec_tester_unittest.cc +++ b/test/video_codec_tester_unittest.cc @@ -652,7 +652,7 @@ TEST_P(VideoCodecTesterTestPacing, PaceDecode) { decoder_settings.pacing_settings = pacing_settings; std::vector frames = VideoCodecTester::RunDecodeTest(env_, &video_source, &decoder_factory, - decoder_settings, SdpVideoFormat("VP8")) + decoder_settings, SdpVideoFormat::VP8()) ->Slice(/*filter=*/{}, /*merge=*/false); ASSERT_THAT(frames, SizeIs(kNumFrames)); EXPECT_NEAR((frames[1].decode_start - frames[0].decode_start).ms(), diff --git a/video/end_to_end_tests/histogram_tests.cc b/video/end_to_end_tests/histogram_tests.cc index 2dd9a2ecc4..4f9f9e2d89 100644 --- a/video/end_to_end_tests/histogram_tests.cc +++ b/video/end_to_end_tests/histogram_tests.cc @@ -107,7 +107,7 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx, send_config->encoder_settings.encoder_factory = &encoder_factory_; send_config->rtp.payload_name = "VP8"; encoder_config->codec_type = kVideoCodecVP8; - (*receive_configs)[0].decoders[0].video_format = SdpVideoFormat("VP8"); + (*receive_configs)[0].decoders[0].video_format = SdpVideoFormat::VP8(); (*receive_configs)[0].rtp.red_payload_type = test::VideoTestConstants::kRedPayloadType; (*receive_configs)[0].rtp.ulpfec_payload_type = diff --git a/video/end_to_end_tests/retransmission_tests.cc b/video/end_to_end_tests/retransmission_tests.cc index 10828fa005..a0e404ff84 100644 --- a/video/end_to_end_tests/retransmission_tests.cc +++ b/video/end_to_end_tests/retransmission_tests.cc @@ -469,7 +469,7 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx, send_config->encoder_settings.encoder_factory = &encoder_factory_; send_config->rtp.payload_name = "VP8"; encoder_config->codec_type = kVideoCodecVP8; - (*receive_configs)[0].decoders[0].video_format = SdpVideoFormat("VP8"); + (*receive_configs)[0].decoders[0].video_format = SdpVideoFormat::VP8(); } void OnFrameGeneratorCapturerCreated( diff --git a/video/picture_id_tests.cc b/video/picture_id_tests.cc index 09b9118cc7..25f0fc37c6 100644 --- a/video/picture_id_tests.cc +++ b/video/picture_id_tests.cc @@ -390,7 +390,7 @@ TEST_P(PictureIdTest, ContinuousAfterReconfigureSimulcastEncoderAdapter) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); SetupEncoder(&encoder_factory, "VP8"); TestPictureIdContinuousAfterReconfigure({1, 3, 3, 1, 1}); @@ -403,7 +403,7 @@ TEST_P(PictureIdTest, test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); SetupEncoder(&encoder_factory, "VP8"); TestPictureIdIncreaseAfterRecreateStreams({1, 3, 3, 1, 1}); @@ -414,7 +414,7 @@ TEST_P(PictureIdTest, ContinuousAfterStreamCountChangeSimulcastEncoderAdapter) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); // Make sure that the picture id is not reset if the stream count goes // down and then up. diff --git a/video/video_receive_stream2_unittest.cc b/video/video_receive_stream2_unittest.cc index 221d17b5be..5b1b664453 100644 --- a/video/video_receive_stream2_unittest.cc +++ b/video/video_receive_stream2_unittest.cc @@ -238,7 +238,7 @@ class VideoReceiveStream2Test : public ::testing::TestWithParam { config_.renderer = &fake_renderer_; VideoReceiveStreamInterface::Decoder h264_decoder; h264_decoder.payload_type = 99; - h264_decoder.video_format = SdpVideoFormat("H264"); + h264_decoder.video_format = SdpVideoFormat::H264(); h264_decoder.video_format.parameters.insert( {"sprop-parameter-sets", "Z0IACpZTBYmI,aMljiA=="}); VideoReceiveStreamInterface::Decoder h265_decoder; diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc index 37acd2dc49..bf97d29587 100644 --- a/video/video_send_stream_tests.cc +++ b/video/video_send_stream_tests.cc @@ -4214,7 +4214,7 @@ TEST_F(VideoSendStreamTest, TestTemporalLayersVp8) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", @@ -4227,7 +4227,7 @@ TEST_F(VideoSendStreamTest, TestTemporalLayersVp8Simulcast) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", @@ -4240,7 +4240,7 @@ TEST_F(VideoSendStreamTest, TestTemporalLayersVp8SimulcastWithDifferentNumTls) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", @@ -4262,7 +4262,7 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8L1T2) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", @@ -4274,7 +4274,7 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8Simulcast) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", @@ -4287,7 +4287,7 @@ TEST_F(VideoSendStreamTest, TestScalabilityModeVp8SimulcastWithDifferentMode) { test::FunctionVideoEncoderFactory encoder_factory( [&internal_encoder_factory]() { return std::make_unique( - &internal_encoder_factory, SdpVideoFormat("VP8")); + &internal_encoder_factory, SdpVideoFormat::VP8()); }); TestTemporalLayers(&encoder_factory, "VP8", diff --git a/video/video_stream_decoder_impl_unittest.cc b/video/video_stream_decoder_impl_unittest.cc index d0cf9255c3..6942e06679 100644 --- a/video/video_stream_decoder_impl_unittest.cc +++ b/video/video_stream_decoder_impl_unittest.cc @@ -131,12 +131,13 @@ class VideoStreamDecoderImplTest : public ::testing::Test { public: VideoStreamDecoderImplTest() : time_controller_(Timestamp::Seconds(0)), - video_stream_decoder_(&callbacks_, - &decoder_factory_, - time_controller_.GetTaskQueueFactory(), - {{1, std::make_pair(SdpVideoFormat("VP8"), 1)}, - {2, std::make_pair(SdpVideoFormat("AV1"), 1)}}, - &field_trials_) { + video_stream_decoder_( + &callbacks_, + &decoder_factory_, + time_controller_.GetTaskQueueFactory(), + {{1, std::make_pair(SdpVideoFormat::VP8(), 1)}, + {2, std::make_pair(SdpVideoFormat::AV1Profile0(), 1)}}, + &field_trials_) { // Set the min playout delay to a value greater than zero to not activate // the low-latency renderer. video_stream_decoder_.SetMinPlayoutDelay(TimeDelta::Millis(10));