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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 VP9Decoder::DecodeResult VP9Decoder::Decode() { | 54 VP9Decoder::DecodeResult VP9Decoder::Decode() { |
55 while (1) { | 55 while (1) { |
56 // Read a new frame header if one is not awaiting decoding already. | 56 // Read a new frame header if one is not awaiting decoding already. |
57 if (!curr_frame_hdr_) { | 57 if (!curr_frame_hdr_) { |
58 std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader()); | 58 std::unique_ptr<Vp9FrameHeader> hdr(new Vp9FrameHeader()); |
59 Vp9Parser::Result res = parser_.ParseNextFrame(hdr.get()); | 59 Vp9Parser::Result res = parser_.ParseNextFrame(hdr.get()); |
60 switch (res) { | 60 switch (res) { |
61 case Vp9Parser::kOk: | 61 case Vp9Parser::kOk: |
62 curr_frame_hdr_.reset(hdr.release()); | 62 curr_frame_hdr_ = std::move(hdr); |
63 break; | 63 break; |
64 | 64 |
65 case Vp9Parser::kEOStream: | 65 case Vp9Parser::kEOStream: |
66 return kRanOutOfStreamData; | 66 return kRanOutOfStreamData; |
67 | 67 |
68 case Vp9Parser::kInvalidStream: | 68 case Vp9Parser::kInvalidStream: |
69 DVLOG(1) << "Error parsing stream"; | 69 DVLOG(1) << "Error parsing stream"; |
70 SetError(); | 70 SetError(); |
71 return kDecodeError; | 71 return kDecodeError; |
72 | 72 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return pic_size_; | 204 return pic_size_; |
205 } | 205 } |
206 | 206 |
207 size_t VP9Decoder::GetRequiredNumOfPictures() const { | 207 size_t VP9Decoder::GetRequiredNumOfPictures() const { |
208 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the | 208 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the |
209 // pictures being parsed and decoded currently. | 209 // pictures being parsed and decoded currently. |
210 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2; | 210 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2; |
211 } | 211 } |
212 | 212 |
213 } // namespace media | 213 } // namespace media |
OLD | NEW |