Index: media/gpu/vp8_decoder.cc |
diff --git a/media/gpu/vp8_decoder.cc b/media/gpu/vp8_decoder.cc |
index 9d582ed0a627a3c862fe60e8aec93c38d27f9126..f7430651c9002ed9815563bdfac0334cc65b8b6f 100644 |
--- a/media/gpu/vp8_decoder.cc |
+++ b/media/gpu/vp8_decoder.cc |
@@ -65,9 +65,24 @@ VP8Decoder::DecodeResult VP8Decoder::Decode() { |
} |
if (curr_frame_hdr_->IsKeyframe()) { |
- gfx::Size new_pic_size(curr_frame_hdr_->width, curr_frame_hdr_->height); |
- if (new_pic_size.IsEmpty()) |
+ gfx::Rect new_visible_rect(curr_frame_hdr_->width, curr_frame_hdr_->height); |
+ if (new_visible_rect.IsEmpty()) |
return kDecodeError; |
+ visible_rect_ = new_visible_rect; |
+ DVLOG(2) << "Visible size: " << visible_rect_.ToString(); |
+ |
+ // Per spec, frame size is not necessarily evenly divisible by 16, while |
+ // frame is encoded by 16x16 macroblock units. Add excess width and height |
+ // to be divisible by 16. |
+ uint16_t coded_width = |
Owen Lin
2017/06/14 02:28:25
You may use base::bits::Align.
https://cs.chromiu
johnylin1
2017/06/14 14:11:22
Sounds good to me. Let's create another CL then.
|
+ (curr_frame_hdr_->width & 15) |
+ ? curr_frame_hdr_->width + 16 - (curr_frame_hdr_->width & 15) |
+ : curr_frame_hdr_->width; |
+ uint16_t coded_height = |
+ (curr_frame_hdr_->height & 15) |
+ ? curr_frame_hdr_->height + 16 - (curr_frame_hdr_->height & 15) |
+ : curr_frame_hdr_->height; |
+ gfx::Size new_pic_size(coded_width, coded_height); |
if (new_pic_size != pic_size_) { |
DVLOG(2) << "New resolution: " << new_pic_size.ToString(); |
@@ -94,6 +109,7 @@ VP8Decoder::DecodeResult VP8Decoder::Decode() { |
if (!curr_pic_) |
return kRanOutOfSurfaces; |
+ curr_pic_->visible_rect = visible_rect_; |
if (!DecodeAndOutputCurrentFrame()) |
return kDecodeError; |