Chromium Code Reviews| Index: media/gpu/h264_decoder.cc |
| diff --git a/media/gpu/h264_decoder.cc b/media/gpu/h264_decoder.cc |
| index aed9658374805c9854aaf4c0fa76dc34e67a5412..798605cd1e7dbc520aed5f28367ddf4660c23fae 100644 |
| --- a/media/gpu/h264_decoder.cc |
| +++ b/media/gpu/h264_decoder.cc |
| @@ -1093,6 +1093,12 @@ bool H264Decoder::ProcessSPS(int sps_id, bool* need_new_buffers) { |
| return false; |
| } |
| + gfx::Rect new_visible_rect = sps->GetVisibleRect().value_or(gfx::Rect()); |
| + if (new_visible_rect.IsEmpty()) { |
|
Owen Lin
2017/06/07 06:10:59
I think we shouldn't fail in the case. We can stil
kcwu
2017/06/07 07:15:27
Maybe check what spec say how to handle invalid si
johnylin1
2017/06/07 15:38:37
In H264Parser::GetVisibleRect() it already checked
|
| + DVLOG(1) << "Invalid visible rect"; |
| + return false; |
| + } |
| + |
| int width_mb = new_pic_size.width() / 16; |
| int height_mb = new_pic_size.height() / 16; |
| @@ -1114,13 +1120,16 @@ bool H264Decoder::ProcessSPS(int sps_id, bool* need_new_buffers) { |
| return false; |
| } |
| - if ((pic_size_ != new_pic_size) || (dpb_.max_num_pics() != max_dpb_size)) { |
| + if ((pic_size_ != new_pic_size) || (visible_rect_ != new_visible_rect) || |
|
Owen Lin
2017/06/07 06:10:59
We don't care about visible rect change here. Mayb
johnylin1
2017/06/07 15:38:37
Done.
|
| + (dpb_.max_num_pics() != max_dpb_size)) { |
| if (!Flush()) |
| return false; |
| DVLOG(1) << "Codec level: " << level << ", DPB size: " << max_dpb_size |
| - << ", Picture size: " << new_pic_size.ToString(); |
| + << ", Picture size: " << new_pic_size.ToString() |
| + << ", Visible rect: " << new_visible_rect.ToString(); |
| *need_new_buffers = true; |
| pic_size_ = new_pic_size; |
| + visible_rect_ = new_visible_rect; |
| dpb_.set_max_num_pics(max_dpb_size); |
| } |
| @@ -1429,6 +1438,10 @@ gfx::Size H264Decoder::GetPicSize() const { |
| return pic_size_; |
| } |
| +gfx::Rect H264Decoder::GetVisibleRect() const { |
| + return visible_rect_; |
| +} |
| + |
| size_t H264Decoder::GetRequiredNumOfPictures() const { |
| return dpb_.max_num_pics() + kPicsInPipeline; |
| } |