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:
@ -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,31 +39,9 @@ bool VideoCodecInitializer::SetupCodec(
|
||||
}
|
||||
|
||||
*codec = VideoEncoderConfigToVideoCodec(config, streams);
|
||||
*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,
|
||||
|
Reference in New Issue
Block a user