| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/common/gpu/media/h264_dpb.h" | 9 #include "content/common/gpu/media/h264_dpb.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 H264DPB::H264DPB() : max_num_pics_(0) {} | 13 H264DPB::H264DPB() : max_num_pics_(0) {} |
| 14 H264DPB::~H264DPB() {} | 14 H264DPB::~H264DPB() {} |
| 15 | 15 |
| 16 void H264DPB::Clear() { | 16 void H264DPB::Clear() { |
| 17 pics_.clear(); | 17 pics_.clear(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void H264DPB::set_max_num_pics(size_t max_num_pics) { | 20 void H264DPB::set_max_num_pics(size_t max_num_pics) { |
| 21 DCHECK_LE(max_num_pics, kDPBMaxSize); | 21 DCHECK_LE(max_num_pics, kDPBMaxSize); |
| 22 max_num_pics_ = max_num_pics; | 22 max_num_pics_ = max_num_pics; |
| 23 if (pics_.size() > max_num_pics_) | 23 if (pics_.size() > max_num_pics_) |
| 24 pics_.resize(max_num_pics_); | 24 pics_.resize(max_num_pics_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void H264DPB::RemoveByPOC(int poc) { | 27 void H264DPB::DeleteByPOC(int poc) { |
| 28 for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ++it) { | 28 for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ++it) { |
| 29 if ((*it)->pic_order_cnt == poc) { | 29 if ((*it)->pic_order_cnt == poc) { |
| 30 pics_.erase(it); | 30 pics_.erase(it); |
| 31 return; | 31 return; |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 NOTREACHED() << "Missing POC: " << poc; | 34 NOTREACHED() << "Missing POC: " << poc; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void H264DPB::RemoveUnused() { | 37 void H264DPB::DeleteUnused() { |
| 38 for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ) { | 38 for (Pictures::iterator it = pics_.begin(); it != pics_.end(); ) { |
| 39 if ((*it)->outputted && !(*it)->ref) | 39 if ((*it)->outputted && !(*it)->ref) |
| 40 it = pics_.erase(it); | 40 it = pics_.erase(it); |
| 41 else | 41 else |
| 42 ++it; | 42 ++it; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void H264DPB::StorePic(H264Picture* pic) { | 46 void H264DPB::StorePic(H264Picture* pic) { |
| 47 DCHECK_LT(pics_.size(), max_num_pics_); | 47 DCHECK_LT(pics_.size(), max_num_pics_); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 void H264DPB::GetLongTermRefPicsAppending(H264Picture::PtrVector& out) { | 116 void H264DPB::GetLongTermRefPicsAppending(H264Picture::PtrVector& out) { |
| 117 for (size_t i = 0; i < pics_.size(); ++i) { | 117 for (size_t i = 0; i < pics_.size(); ++i) { |
| 118 H264Picture* pic = pics_[i]; | 118 H264Picture* pic = pics_[i]; |
| 119 if (pic->ref && pic->long_term) | 119 if (pic->ref && pic->long_term) |
| 120 out.push_back(pic); | 120 out.push_back(pic); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace content | 124 } // namespace content |
| OLD | NEW |