Use the factory instead of using the builtin code path in VideoCodecInitializer.

Bug: webrtc:9513
Change-Id: Ia299ae1044a3ff4c91e208200938cba540bdcea6
Reviewed-on: https://webrtc-review.googlesource.com/c/94782
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25456}
This commit is contained in:
Jiawei Ou
2018-10-10 01:16:20 -07:00
committed by Commit Bot
parent 838643550f
commit be142178aa
57 changed files with 389 additions and 137 deletions

View File

@ -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"
@ -86,6 +87,7 @@ class VideoCodingModuleImpl : public VideoCodingModule {
KeyFrameRequestSender* keyframe_request_sender)
: VideoCodingModule(),
sender_(clock, &post_encode_callback_),
rate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()),
timing_(new VCMTiming(clock)),
receiver_(clock,
event_factory,
@ -114,7 +116,8 @@ class VideoCodingModuleImpl : public VideoCodingModule {
// 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);
@ -213,8 +216,9 @@ class VideoCodingModuleImpl : public VideoCodingModule {
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