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/vp8_decoder.h" | 5 #include "media/gpu/vp8_decoder.h" |
6 #include "media/base/limits.h" | 6 #include "media/base/limits.h" |
7 | 7 |
8 namespace media { | 8 namespace media { |
9 | 9 |
10 VP8Decoder::VP8Accelerator::VP8Accelerator() {} | 10 VP8Decoder::VP8Accelerator::VP8Accelerator() {} |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 curr_frame_hdr_.reset(new Vp8FrameHeader()); | 58 curr_frame_hdr_.reset(new Vp8FrameHeader()); |
59 if (!parser_.ParseFrame(curr_frame_start_, frame_size_, | 59 if (!parser_.ParseFrame(curr_frame_start_, frame_size_, |
60 curr_frame_hdr_.get())) { | 60 curr_frame_hdr_.get())) { |
61 DVLOG(1) << "Error during decode"; | 61 DVLOG(1) << "Error during decode"; |
62 state_ = kError; | 62 state_ = kError; |
63 return kDecodeError; | 63 return kDecodeError; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 if (curr_frame_hdr_->IsKeyframe()) { | 67 if (curr_frame_hdr_->IsKeyframe()) { |
68 gfx::Size new_pic_size(curr_frame_hdr_->width, curr_frame_hdr_->height); | 68 gfx::Size new_pic_size(curr_frame_hdr_->width, curr_frame_hdr_->height); |
Pawel Osciak
2017/06/08 04:58:25
Per spec, width/height in frame header may not be
johnylin1
2017/06/12 13:41:53
I thought we did the alignment while v4l2_slice_vd
johnylin1
2017/06/13 15:23:56
Done, as following to spec.
| |
69 if (new_pic_size.IsEmpty()) | 69 if (new_pic_size.IsEmpty()) |
70 return kDecodeError; | 70 return kDecodeError; |
71 | 71 |
72 if (new_pic_size != pic_size_) { | 72 if (new_pic_size != pic_size_) { |
73 DVLOG(2) << "New resolution: " << new_pic_size.ToString(); | 73 DVLOG(2) << "New resolution: " << new_pic_size.ToString(); |
74 pic_size_ = new_pic_size; | 74 pic_size_ = new_pic_size; |
75 | 75 |
76 DCHECK(!curr_pic_); | 76 DCHECK(!curr_pic_); |
77 last_frame_ = nullptr; | 77 last_frame_ = nullptr; |
78 golden_frame_ = nullptr; | 78 golden_frame_ = nullptr; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 curr_frame_hdr_->height = pic_size_.height(); | 162 curr_frame_hdr_->height = pic_size_.height(); |
163 curr_frame_hdr_->horizontal_scale = horizontal_scale_; | 163 curr_frame_hdr_->horizontal_scale = horizontal_scale_; |
164 curr_frame_hdr_->vertical_scale = vertical_scale_; | 164 curr_frame_hdr_->vertical_scale = vertical_scale_; |
165 } | 165 } |
166 | 166 |
167 if (!accelerator_->SubmitDecode(curr_pic_, curr_frame_hdr_.get(), last_frame_, | 167 if (!accelerator_->SubmitDecode(curr_pic_, curr_frame_hdr_.get(), last_frame_, |
168 golden_frame_, alt_frame_)) | 168 golden_frame_, alt_frame_)) |
169 return false; | 169 return false; |
170 | 170 |
171 if (curr_frame_hdr_->show_frame) | 171 if (curr_frame_hdr_->show_frame) |
172 if (!accelerator_->OutputPicture(curr_pic_)) | 172 if (!accelerator_->OutputPicture(curr_pic_, gfx::Rect(pic_size_))) |
173 return false; | 173 return false; |
174 | 174 |
175 RefreshReferenceFrames(); | 175 RefreshReferenceFrames(); |
176 | 176 |
177 curr_pic_ = nullptr; | 177 curr_pic_ = nullptr; |
178 curr_frame_hdr_ = nullptr; | 178 curr_frame_hdr_ = nullptr; |
179 curr_frame_start_ = nullptr; | 179 curr_frame_start_ = nullptr; |
180 frame_size_ = 0; | 180 frame_size_ = 0; |
181 return true; | 181 return true; |
182 } | 182 } |
183 | 183 |
184 gfx::Size VP8Decoder::GetPicSize() const { | 184 gfx::Size VP8Decoder::GetPicSize() const { |
185 return pic_size_; | 185 return pic_size_; |
186 } | 186 } |
187 | 187 |
188 size_t VP8Decoder::GetRequiredNumOfPictures() const { | 188 size_t VP8Decoder::GetRequiredNumOfPictures() const { |
189 const size_t kVP8NumFramesActive = 4; | 189 const size_t kVP8NumFramesActive = 4; |
190 const size_t kPicsInPipeline = limits::kMaxVideoFrames + 2; | 190 const size_t kPicsInPipeline = limits::kMaxVideoFrames + 2; |
191 return kVP8NumFramesActive + kPicsInPipeline; | 191 return kVP8NumFramesActive + kPicsInPipeline; |
192 } | 192 } |
193 | 193 |
194 } // namespace media | 194 } // namespace media |
OLD | NEW |