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_coding_impl.cc b/modules/video_coding/video_coding_impl.cc
index 17481bc..4fb5ae3 100644
--- a/modules/video_coding/video_coding_impl.cc
+++ b/modules/video_coding/video_coding_impl.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <utility>
+#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/video_bitrate_allocator.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/libyuv/include/webrtc_libyuv.h"
@@ -81,6 +82,7 @@
KeyFrameRequestSender* keyframe_request_sender)
: VideoCodingModule(),
sender_(clock, &post_encode_callback_),
+ rate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()),
timing_(new VCMTiming(clock)),
receiver_(clock, timing_.get(), nack_sender, keyframe_request_sender) {}
@@ -105,7 +107,8 @@
// asynchronously keep the instance alive until destruction or until a
// new send codec is registered.
VideoCodec codec = *sendCodec;
- rate_allocator_ = VideoCodecInitializer::CreateBitrateAllocator(codec);
+ rate_allocator_ =
+ rate_allocator_factory_->CreateVideoBitrateAllocator(codec);
return sender_.RegisterSendCodec(&codec, numberOfCores, maxPayloadSize);
}
return sender_.RegisterSendCodec(sendCodec, numberOfCores, maxPayloadSize);
@@ -204,8 +207,9 @@
rtc::ThreadChecker construction_thread_;
EncodedImageCallbackWrapper post_encode_callback_;
vcm::VideoSender sender_;
+ const std::unique_ptr<VideoBitrateAllocatorFactory> rate_allocator_factory_;
std::unique_ptr<VideoBitrateAllocator> rate_allocator_;
- std::unique_ptr<VCMTiming> timing_;
+ const std::unique_ptr<VCMTiming> timing_;
vcm::VideoReceiver receiver_;
};
} // namespace