Commit 57163305 authored by Sreerenj Balachandran's avatar Sreerenj Balachandran Committed by Commit Bot

media/gpu: fix the vp9 decode when the stream starts with an Intra only frame

Current implementation allows only a keyframe as the first frame in the
stream. This patch relaxes the requiremnt a bit and legalize the decoding
when it starts with an Intra only frame. Also allows the resolution
change if there is no prior decoded frames and the current frame is an
intra only one.

BUG=889768

Change-Id: Ic3bdedc329072b473f057407101193ac7ba4dc09
Reviewed-on: https://chromium-review.googlesource.com/c/1341146Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611532}
parent 3ea1030a
...@@ -92,7 +92,10 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -92,7 +92,10 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
// Not kDecoding, so we need a resume point (a keyframe), as we are after // Not kDecoding, so we need a resume point (a keyframe), as we are after
// reset or at the beginning of the stream. Drop anything that is not // reset or at the beginning of the stream. Drop anything that is not
// a keyframe in such case, and continue looking for a keyframe. // a keyframe in such case, and continue looking for a keyframe.
if (curr_frame_hdr_->IsKeyframe()) { // Only exception is when the stream/sequence starts with an Intra only
// frame.
if (curr_frame_hdr_->IsKeyframe() ||
(curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
state_ = kDecoding; state_ = kDecoding;
} else { } else {
curr_frame_hdr_.reset(); curr_frame_hdr_.reset();
...@@ -136,11 +139,14 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() { ...@@ -136,11 +139,14 @@ VP9Decoder::DecodeResult VP9Decoder::Decode() {
if (new_pic_size != pic_size_) { if (new_pic_size != pic_size_) {
DVLOG(1) << "New resolution: " << new_pic_size.ToString(); DVLOG(1) << "New resolution: " << new_pic_size.ToString();
if (!curr_frame_hdr_->IsKeyframe()) { if (!curr_frame_hdr_->IsKeyframe() &&
(curr_frame_hdr_->IsIntra() && pic_size_.IsEmpty())) {
// TODO(posciak): This is doable, but requires a few modifications to // TODO(posciak): This is doable, but requires a few modifications to
// VDA implementations to allow multiple picture buffer sets in flight. // VDA implementations to allow multiple picture buffer sets in flight.
// http://crbug.com/832264 // http://crbug.com/832264
DVLOG(1) << "Resolution change currently supported for keyframes only"; DVLOG(1) << "Resolution change currently supported for keyframes and "
"sequence begins with Intra only when there is no prior "
"frames in the context";
if (++size_change_failure_counter_ > kVPxMaxNumOfSizeChangeFailures) { if (++size_change_failure_counter_ > kVPxMaxNumOfSizeChangeFailures) {
SetError(); SetError();
return kDecodeError; return kDecodeError;
......
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