Reland "Use the factory instead of using the builtin code path in `VideoCodecInitializer`"
Compared the original CL: https://webrtc-review.googlesource.com/c/src/+/94782
This new CL added backward compatible functions to WebRtcMediaEngineFactory so that internal projects will not be broken.
Because of that, now we can revert all the changes to SDK and PeerConnection and do it in following CLs. This makes this CL cleaner.
One temporary disadvantage of this is the media engine now need to take a dependency onto builtin video bitrate factory, but practically it just moved code around and should not result in a large binary size change. We can remove this dependency later if needed.
Bug: webrtc:9513
Change-Id: I38708762ff365e4ca05974b99fac71edc739a756
Reviewed-on: https://webrtc-review.googlesource.com/c/109040
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25574}
diff --git a/modules/video_coding/video_codec_initializer.cc b/modules/video_coding/video_codec_initializer.cc
index b676a95..86a5ab2 100644
--- a/modules/video_coding/video_codec_initializer.cc
+++ b/modules/video_coding/video_codec_initializer.cc
@@ -24,15 +24,13 @@
namespace webrtc {
-bool VideoCodecInitializer::SetupCodec(
- const VideoEncoderConfig& config,
- const std::vector<VideoStream>& streams,
- VideoCodec* codec,
- std::unique_ptr<VideoBitrateAllocator>* bitrate_allocator) {
+bool VideoCodecInitializer::SetupCodec(const VideoEncoderConfig& config,
+ const std::vector<VideoStream>& streams,
+ VideoCodec* codec) {
if (config.codec_type == kVideoCodecMultiplex) {
VideoEncoderConfig associated_config = config.Copy();
associated_config.codec_type = kVideoCodecVP9;
- if (!SetupCodec(associated_config, streams, codec, bitrate_allocator)) {
+ if (!SetupCodec(associated_config, streams, codec)) {
RTC_LOG(LS_ERROR) << "Failed to create stereo encoder configuration.";
return false;
}
@@ -41,33 +39,9 @@
}
*codec = VideoEncoderConfigToVideoCodec(config, streams);
- if (bitrate_allocator) {
- *bitrate_allocator = CreateBitrateAllocator(*codec);
- }
-
return true;
}
-std::unique_ptr<VideoBitrateAllocator>
-VideoCodecInitializer::CreateBitrateAllocator(const VideoCodec& codec) {
- std::unique_ptr<VideoBitrateAllocator> rate_allocator;
-
- switch (codec.codecType) {
- case kVideoCodecVP8:
- RTC_FALLTHROUGH();
- case kVideoCodecH264:
- rate_allocator.reset(new SimulcastRateAllocator(codec));
- break;
- case kVideoCodecVP9:
- rate_allocator.reset(new SvcRateAllocator(codec));
- break;
- default:
- rate_allocator.reset(new DefaultVideoBitrateAllocator(codec));
- }
-
- return rate_allocator;
-}
-
// TODO(sprang): Split this up and separate the codec specific parts.
VideoCodec VideoCodecInitializer::VideoEncoderConfigToVideoCodec(
const VideoEncoderConfig& config,