Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/base/video_frame_pool.h" | 5 #include "media/base/video_frame_pool.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 DCHECK(!is_shutdown_); | 65 DCHECK(!is_shutdown_); |
| 66 | 66 |
| 67 scoped_refptr<VideoFrame> frame; | 67 scoped_refptr<VideoFrame> frame; |
| 68 | 68 |
| 69 while (!frame && !frames_.empty()) { | 69 while (!frame && !frames_.empty()) { |
| 70 scoped_refptr<VideoFrame> pool_frame = frames_.front(); | 70 scoped_refptr<VideoFrame> pool_frame = frames_.front(); |
| 71 frames_.pop_front(); | 71 frames_.pop_front(); |
| 72 | 72 |
| 73 if (pool_frame->format() == format && | 73 if (pool_frame->format() == format && |
| 74 pool_frame->coded_size() == coded_size && | 74 pool_frame->coded_size() == coded_size && |
| 75 pool_frame->visible_rect() == visible_rect && | |
| 76 pool_frame->natural_size() == natural_size) { | 75 pool_frame->natural_size() == natural_size) { |
|
Ami GONE FROM CHROMIUM
2014/03/05 16:23:42
Should add a subrect test.
perkj_chrome
2014/03/05 16:39:49
? VideoFramePoolUnitTest::FrameReuseWithDifferentV
| |
| 77 frame = pool_frame; | 76 frame = pool_frame; |
| 78 frame->SetTimestamp(timestamp); | 77 frame->SetTimestamp(timestamp); |
| 79 break; | 78 break; |
| 80 } | 79 } |
| 81 } | 80 } |
| 82 | 81 |
| 83 if (!frame) { | 82 if (!frame) { |
| 84 frame = VideoFrame::CreateFrame( | 83 frame = VideoFrame::CreateFrame( |
| 85 format, coded_size, visible_rect, natural_size, timestamp); | 84 format, coded_size, visible_rect, natural_size, timestamp); |
| 86 } | 85 } |
| 87 | 86 |
| 88 return VideoFrame::WrapVideoFrame( | 87 return VideoFrame::WrapVideoFrame( |
| 89 frame, base::Bind(&VideoFramePool::PoolImpl::FrameReleased, this, frame)); | 88 frame, visible_rect, |
| 89 base::Bind(&VideoFramePool::PoolImpl::FrameReleased, this, frame)); | |
| 90 } | 90 } |
| 91 | 91 |
| 92 void VideoFramePool::PoolImpl::Shutdown() { | 92 void VideoFramePool::PoolImpl::Shutdown() { |
| 93 base::AutoLock auto_lock(lock_); | 93 base::AutoLock auto_lock(lock_); |
| 94 is_shutdown_ = true; | 94 is_shutdown_ = true; |
| 95 frames_.clear(); | 95 frames_.clear(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void VideoFramePool::PoolImpl::FrameReleased( | 98 void VideoFramePool::PoolImpl::FrameReleased( |
| 99 const scoped_refptr<VideoFrame>& frame) { | 99 const scoped_refptr<VideoFrame>& frame) { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 119 base::TimeDelta timestamp) { | 119 base::TimeDelta timestamp) { |
| 120 return pool_->CreateFrame(format, coded_size, visible_rect, natural_size, | 120 return pool_->CreateFrame(format, coded_size, visible_rect, natural_size, |
| 121 timestamp); | 121 timestamp); |
| 122 } | 122 } |
| 123 | 123 |
| 124 size_t VideoFramePool::GetPoolSizeForTesting() const { | 124 size_t VideoFramePool::GetPoolSizeForTesting() const { |
| 125 return pool_->GetPoolSizeForTesting(); | 125 return pool_->GetPoolSizeForTesting(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace media | 128 } // namespace media |
| OLD | NEW |