| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 5 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 13 #include "media/base/video_util.h" | 13 #include "media/base/video_util.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 const int VideoCaptureBufferPool::kInvalidId = -1; | 17 const int VideoCaptureBufferPool::kInvalidId = -1; |
| 18 | 18 |
| 19 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) | 19 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) |
| 20 : count_(count), | 20 : count_(count), |
| 21 next_buffer_id_(0) { | 21 next_buffer_id_(0) { |
| 22 DCHECK_GT(count, 0); |
| 22 } | 23 } |
| 23 | 24 |
| 24 VideoCaptureBufferPool::~VideoCaptureBufferPool() { | 25 VideoCaptureBufferPool::~VideoCaptureBufferPool() { |
| 25 STLDeleteValues(&buffers_); | 26 STLDeleteValues(&buffers_); |
| 26 } | 27 } |
| 27 | 28 |
| 28 base::SharedMemoryHandle VideoCaptureBufferPool::ShareToProcess( | 29 base::SharedMemoryHandle VideoCaptureBufferPool::ShareToProcess( |
| 29 int buffer_id, | 30 int buffer_id, |
| 30 base::ProcessHandle process_handle, | 31 base::ProcessHandle process_handle, |
| 31 size_t* memory_size) { | 32 size_t* memory_size) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 162 |
| 162 VideoCaptureBufferPool::Buffer* VideoCaptureBufferPool::GetBuffer( | 163 VideoCaptureBufferPool::Buffer* VideoCaptureBufferPool::GetBuffer( |
| 163 int buffer_id) { | 164 int buffer_id) { |
| 164 BufferMap::iterator it = buffers_.find(buffer_id); | 165 BufferMap::iterator it = buffers_.find(buffer_id); |
| 165 if (it == buffers_.end()) | 166 if (it == buffers_.end()) |
| 166 return NULL; | 167 return NULL; |
| 167 return it->second; | 168 return it->second; |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace content | 171 } // namespace content |
| 171 | |
| OLD | NEW |