Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/gpu/vp9_decoder.h" | 5 #include "media/gpu/vp9_decoder.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 ref_frame = nullptr; | 131 ref_frame = nullptr; |
| 132 | 132 |
| 133 pic_size_ = new_pic_size; | 133 pic_size_ = new_pic_size; |
| 134 return kAllocateNewSurfaces; | 134 return kAllocateNewSurfaces; |
| 135 } | 135 } |
| 136 | 136 |
| 137 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture(); | 137 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture(); |
| 138 if (!pic) | 138 if (!pic) |
| 139 return kRanOutOfSurfaces; | 139 return kRanOutOfSurfaces; |
| 140 | 140 |
| 141 gfx::Rect new_render_rect(curr_frame_hdr_->render_width, | |
| 142 curr_frame_hdr_->render_height); | |
| 143 // For safety, check the validity of render size or leave it as (0, 0). | |
| 144 if (!gfx::Rect(pic_size_).Contains(new_render_rect)) { | |
| 145 DVLOG(2) << "Render size exceeds picture size. render size: " | |
|
Pawel Osciak
2017/06/19 06:27:40
s/2/1/ please.
johnylin1
2017/06/19 07:13:28
Done.
| |
| 146 << new_render_rect.ToString() | |
| 147 << ", picture size: " << pic_size_.ToString(); | |
| 148 new_render_rect = gfx::Rect(); | |
| 149 } | |
| 150 DVLOG(2) << "Render resolution: " << new_render_rect.ToString(); | |
| 151 | |
| 152 pic->visible_rect = new_render_rect; | |
| 141 pic->frame_hdr.reset(curr_frame_hdr_.release()); | 153 pic->frame_hdr.reset(curr_frame_hdr_.release()); |
| 142 | 154 |
| 143 if (!DecodeAndOutputPicture(pic)) { | 155 if (!DecodeAndOutputPicture(pic)) { |
| 144 SetError(); | 156 SetError(); |
| 145 return kDecodeError; | 157 return kDecodeError; |
| 146 } | 158 } |
| 147 } | 159 } |
| 148 } | 160 } |
| 149 | 161 |
| 150 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) { | 162 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 return pic_size_; | 216 return pic_size_; |
| 205 } | 217 } |
| 206 | 218 |
| 207 size_t VP9Decoder::GetRequiredNumOfPictures() const { | 219 size_t VP9Decoder::GetRequiredNumOfPictures() const { |
| 208 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the | 220 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the |
| 209 // pictures being parsed and decoded currently. | 221 // pictures being parsed and decoded currently. |
| 210 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2; | 222 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2; |
| 211 } | 223 } |
| 212 | 224 |
| 213 } // namespace media | 225 } // namespace media |
| OLD | NEW |