Commit 7dac38c9 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Reset video decoder when changing protected mode.

Previously FuchsiaVideoDecoder::Initialize() would keep the decoder
when the stream config is changed from clear to encrypted. That didn't
work correctly because the decoder needs to be re-initialized with
secure input buffers and that mode can be selected only during decoder
creation. Updated FuchsiaVideoDecoder::Initialize() to reset the decoder
whenever protected mode needs to be changed.

Bug: b/142274148
Change-Id: I236abd1e7d1f028ed8144adffc8b184febf789b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2051364Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740497}
parent 960dc104
......@@ -356,29 +356,10 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
waiting_cb_ = waiting_cb;
container_pixel_aspect_ratio_ = config.GetPixelAspectRatio();
// If we already have |decoder_| that was initialized for the same codec then
// keep using it.
if (decoder_ && current_codec_ == config.codec()) {
bool have_decryptor = decryptor_ != nullptr;
if (have_decryptor != config.is_encrypted()) {
// If decryption mode has changed then we need to re-initialize input
// buffers.
ReleaseInputBuffers();
decryptor_.reset();
// Initialize decryptor for encrypted streams.
if (config.is_encrypted() && !InitializeDecryptor(cdm_context)) {
std::move(done_callback).Run(false);
return;
}
// If we haven't received input constraints yet then input buffers will be
// initialized later when OnInputConstraints() is received.
if (decoder_input_constraints_.has_value()) {
OnInputConstraints(std::move(decoder_input_constraints_).value());
}
}
// Keep decoder and decryptor if the configuration hasn't changed.
bool have_decryptor = decryptor_ != nullptr;
if (decoder_ && current_codec_ == config.codec() &&
have_decryptor == config.is_encrypted()) {
std::move(done_callback).Run(true);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment