Migrate software decoders to new VideoDecoder::Configure

Bug: webrtc:13045
Change-Id: I1fa28a7c2dd59f0889d98c8ec5f58161c0ec9f95
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228380
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34716}
This commit is contained in:
Danil Chapovalov
2021-08-10 14:33:31 +02:00
committed by WebRTC LUCI CQ
parent bf75041b8d
commit 53d4be223b
14 changed files with 98 additions and 110 deletions

View File

@ -31,8 +31,7 @@ class MultiplexDecoderAdapter : public VideoDecoder {
virtual ~MultiplexDecoderAdapter();
// Implements VideoDecoder
int32_t InitDecode(const VideoCodec* codec_settings,
int32_t number_of_cores) override;
bool Configure(const Settings& settings) override;
int32_t Decode(const EncodedImage& input_image,
bool missing_frames,
int64_t render_time_ms) override;

View File

@ -104,24 +104,24 @@ MultiplexDecoderAdapter::~MultiplexDecoderAdapter() {
Release();
}
int32_t MultiplexDecoderAdapter::InitDecode(const VideoCodec* codec_settings,
int32_t number_of_cores) {
RTC_DCHECK_EQ(kVideoCodecMultiplex, codec_settings->codecType);
VideoCodec settings = *codec_settings;
settings.codecType = PayloadStringToCodecType(associated_format_.name);
bool MultiplexDecoderAdapter::Configure(const Settings& settings) {
RTC_DCHECK_EQ(settings.codec_type(), kVideoCodecMultiplex);
Settings associated_settings = settings;
associated_settings.set_codec_type(
PayloadStringToCodecType(associated_format_.name));
for (size_t i = 0; i < kAlphaCodecStreams; ++i) {
std::unique_ptr<VideoDecoder> decoder =
factory_->CreateVideoDecoder(associated_format_);
const int32_t rv = decoder->InitDecode(&settings, number_of_cores);
if (rv)
return rv;
if (!decoder->Configure(associated_settings)) {
return false;
}
adapter_callbacks_.emplace_back(
new MultiplexDecoderAdapter::AdapterDecodedImageCallback(
this, static_cast<AlphaCodecStream>(i)));
decoder->RegisterDecodeCompleteCallback(adapter_callbacks_.back().get());
decoders_.emplace_back(std::move(decoder));
}
return WEBRTC_VIDEO_CODEC_OK;
return true;
}
int32_t MultiplexDecoderAdapter::Decode(const EncodedImage& input_image,