| 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 "media/capture/video/video_capture_buffer_pool_impl.h" | 5 #include "media/capture/video/video_capture_buffer_pool_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "media/capture/video/video_capture_buffer_handle.h" | 12 #include "media/capture/video/video_capture_buffer_handle.h" |
| 13 #include "media/capture/video/video_capture_buffer_tracker.h" | 13 #include "media/capture/video/video_capture_buffer_tracker.h" |
| 14 #include "ui/gfx/buffer_format_util.h" | 14 #include "ui/gfx/buffer_format_util.h" |
| 15 | 15 |
| 16 namespace media { | 16 namespace media { |
| 17 | 17 |
| 18 int VideoCaptureBufferPoolImpl::next_buffer_id_ = 0; |
| 19 |
| 18 VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl( | 20 VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl( |
| 19 std::unique_ptr<VideoCaptureBufferTrackerFactory> buffer_tracker_factory, | 21 std::unique_ptr<VideoCaptureBufferTrackerFactory> buffer_tracker_factory, |
| 20 int count) | 22 int count) |
| 21 : count_(count), | 23 : count_(count), |
| 22 next_buffer_id_(0), | |
| 23 last_relinquished_buffer_id_(kInvalidId), | 24 last_relinquished_buffer_id_(kInvalidId), |
| 24 buffer_tracker_factory_(std::move(buffer_tracker_factory)) { | 25 buffer_tracker_factory_(std::move(buffer_tracker_factory)) { |
| 25 DCHECK_GT(count, 0); | 26 DCHECK_GT(count, 0); |
| 26 } | 27 } |
| 27 | 28 |
| 28 VideoCaptureBufferPoolImpl::~VideoCaptureBufferPoolImpl() {} | 29 VideoCaptureBufferPoolImpl::~VideoCaptureBufferPoolImpl() {} |
| 29 | 30 |
| 30 mojo::ScopedSharedBufferHandle | 31 mojo::ScopedSharedBufferHandle |
| 31 VideoCaptureBufferPoolImpl::GetHandleForInterProcessTransit(int buffer_id) { | 32 VideoCaptureBufferPoolImpl::GetHandleForInterProcessTransit(int buffer_id) { |
| 32 base::AutoLock lock(lock_); | 33 base::AutoLock lock(lock_); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 return buffer_id; | 242 return buffer_id; |
| 242 } | 243 } |
| 243 | 244 |
| 244 VideoCaptureBufferTracker* VideoCaptureBufferPoolImpl::GetTracker( | 245 VideoCaptureBufferTracker* VideoCaptureBufferPoolImpl::GetTracker( |
| 245 int buffer_id) { | 246 int buffer_id) { |
| 246 auto it = trackers_.find(buffer_id); | 247 auto it = trackers_.find(buffer_id); |
| 247 return (it == trackers_.end()) ? nullptr : it->second.get(); | 248 return (it == trackers_.end()) ? nullptr : it->second.get(); |
| 248 } | 249 } |
| 249 | 250 |
| 250 } // namespace media | 251 } // namespace media |
| OLD | NEW |