| 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "content/common/gpu/media/vp9_decoder.h" | 6 #include "content/common/gpu/media/vp9_decoder.h" |
| 7 #include "media/base/limits.h" | 7 #include "media/base/limits.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 if (!DecodeAndOutputPicture(pic)) { | 132 if (!DecodeAndOutputPicture(pic)) { |
| 133 SetError(); | 133 SetError(); |
| 134 return kDecodeError; | 134 return kDecodeError; |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) { | 139 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) { |
| 140 for (size_t i = 0; i < media::kVp9NumRefFrames; ++i) { | 140 for (size_t i = 0; i < media::kVp9NumRefFrames; ++i) { |
| 141 DCHECK(!pic->frame_hdr->IsKeyframe() || pic->frame_hdr->RefreshFlag(i)); | 141 DCHECK_IMPLIES(pic->frame_hdr->IsKeyframe(), |
| 142 pic->frame_hdr->RefreshFlag(i)); |
| 142 if (pic->frame_hdr->RefreshFlag(i)) | 143 if (pic->frame_hdr->RefreshFlag(i)) |
| 143 ref_frames_[i] = pic; | 144 ref_frames_[i] = pic; |
| 144 } | 145 } |
| 145 } | 146 } |
| 146 | 147 |
| 147 bool VP9Decoder::DecodeAndOutputPicture(scoped_refptr<VP9Picture> pic) { | 148 bool VP9Decoder::DecodeAndOutputPicture(scoped_refptr<VP9Picture> pic) { |
| 148 DCHECK(!pic_size_.IsEmpty()); | 149 DCHECK(!pic_size_.IsEmpty()); |
| 149 DCHECK(pic->frame_hdr); | 150 DCHECK(pic->frame_hdr); |
| 150 | 151 |
| 151 if (!accelerator_->SubmitDecode(pic, parser_.GetSegmentation(), | 152 if (!accelerator_->SubmitDecode(pic, parser_.GetSegmentation(), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 170 return pic_size_; | 171 return pic_size_; |
| 171 } | 172 } |
| 172 | 173 |
| 173 size_t VP9Decoder::GetRequiredNumOfPictures() const { | 174 size_t VP9Decoder::GetRequiredNumOfPictures() const { |
| 174 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the | 175 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the |
| 175 // pictures being parsed and decoded currently. | 176 // pictures being parsed and decoded currently. |
| 176 return media::limits::kMaxVideoFrames + media::kVp9NumRefFrames + 2; | 177 return media::limits::kMaxVideoFrames + media::kVp9NumRefFrames + 2; |
| 177 } | 178 } |
| 178 | 179 |
| 179 } // namespace content | 180 } // namespace content |
| OLD | NEW |