Commit 48ebdb69 authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Chromium LUCI CQ

media: Fix retention of DecryptConfig on resolution changes

When a resolution change event occurred, we would have parsed the
curr_frame_hdr_, but then this would cause us to skip extracting the
DecryptConfig for the current frame. This retains the DecryptConfig so
it can be used when that frame is decoded.

BUG=b:155509231
TEST=Encrypted VP9 plays back on volteer w/out corruption

Change-Id: Ie005d2bcea0677342e262a96eb3b97d919cbf9a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622750
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Auto-Submit: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842177}
parent 62b0c8d1
...@@ -120,6 +120,7 @@ bool VP9Decoder::Flush() { ...@@ -120,6 +120,7 @@ bool VP9Decoder::Flush() {
void VP9Decoder::Reset() { void VP9Decoder::Reset() {
curr_frame_hdr_ = nullptr; curr_frame_hdr_ = nullptr;
decrypt_config_.reset();
pending_pic_.reset(); pending_pic_.reset();
ref_frames_.Clear(); ref_frames_.Clear();
...@@ -146,12 +147,11 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -146,12 +147,11 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
} }
// Read a new frame header if one is not awaiting decoding already. // Read a new frame header if one is not awaiting decoding already.
std::unique_ptr<DecryptConfig> decrypt_config;
if (!curr_frame_hdr_) { if (!curr_frame_hdr_) {
gfx::Size allocate_size; gfx::Size allocate_size;
std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader()); std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader());
Vp9Parser::Result res = Vp9Parser::Result res =
parser_.ParseNextFrame(hdr.get(), &allocate_size, &decrypt_config); parser_.ParseNextFrame(hdr.get(), &allocate_size, &decrypt_config_);
switch (res) { switch (res) {
case Vp9Parser::kOk: case Vp9Parser::kOk:
curr_frame_hdr_ = std::move(hdr); curr_frame_hdr_ = std::move(hdr);
...@@ -183,6 +183,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -183,6 +183,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
state_ = kDecoding; state_ = kDecoding;
} else { } else {
curr_frame_hdr_.reset(); curr_frame_hdr_.reset();
decrypt_config_.reset();
continue; continue;
} }
} }
...@@ -215,6 +216,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -215,6 +216,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
} }
curr_frame_hdr_.reset(); curr_frame_hdr_.reset();
decrypt_config_.reset();
continue; continue;
} }
...@@ -267,6 +269,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -267,6 +269,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
} }
curr_frame_hdr_.reset(); curr_frame_hdr_.reset();
decrypt_config_.reset();
return kRanOutOfStreamData; return kRanOutOfStreamData;
} }
...@@ -293,7 +296,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -293,7 +296,7 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
pic->set_visible_rect(new_render_rect); pic->set_visible_rect(new_render_rect);
pic->set_bitstream_id(stream_id_); pic->set_bitstream_id(stream_id_);
pic->set_decrypt_config(std::move(decrypt_config)); pic->set_decrypt_config(std::move(decrypt_config_));
// For VP9, container color spaces override video stream color spaces. // For VP9, container color spaces override video stream color spaces.
if (container_color_space_.IsSpecified()) if (container_color_space_.IsSpecified())
......
...@@ -157,8 +157,10 @@ class MEDIA_GPU_EXPORT VP9Decoder : public AcceleratedVideoDecoder { ...@@ -157,8 +157,10 @@ class MEDIA_GPU_EXPORT VP9Decoder : public AcceleratedVideoDecoder {
// Current stream buffer id; to be assigned to pictures decoded from it. // Current stream buffer id; to be assigned to pictures decoded from it.
int32_t stream_id_ = -1; int32_t stream_id_ = -1;
// Current frame header to be used in decoding the next picture. // Current frame header and decrypt config to be used in decoding the next
// picture.
std::unique_ptr<Vp9FrameHeader> curr_frame_hdr_; std::unique_ptr<Vp9FrameHeader> curr_frame_hdr_;
std::unique_ptr<DecryptConfig> decrypt_config_;
// Current frame size that is necessary to decode |curr_frame_hdr_|. // Current frame size that is necessary to decode |curr_frame_hdr_|.
gfx::Size curr_frame_size_; gfx::Size curr_frame_size_;
......
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