Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: content/browser/renderer_host/media/video_capture_buffer_pool.cc

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix many thread issues Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 27 matching lines...) Expand all
38 return base::SharedMemory::NULLHandle(); 38 return base::SharedMemory::NULLHandle();
39 } 39 }
40 base::SharedMemoryHandle remote_handle; 40 base::SharedMemoryHandle remote_handle;
41 buffer->shared_memory.ShareToProcess(process_handle, &remote_handle); 41 buffer->shared_memory.ShareToProcess(process_handle, &remote_handle);
42 *memory_size = buffer->shared_memory.requested_size(); 42 *memory_size = buffer->shared_memory.requested_size();
43 return remote_handle; 43 return remote_handle;
44 } 44 }
45 45
46 bool VideoCaptureBufferPool::GetBufferInfo(int buffer_id, 46 bool VideoCaptureBufferPool::GetBufferInfo(int buffer_id,
47 void** memory, 47 void** memory,
48 size_t* size) { 48 size_t* size,
49 base::SharedMemoryHandle* handle) {
49 base::AutoLock lock(lock_); 50 base::AutoLock lock(lock_);
50 51
51 Buffer* buffer = GetBuffer(buffer_id); 52 Buffer* buffer = GetBuffer(buffer_id);
52 if (!buffer) { 53 if (!buffer) {
53 NOTREACHED() << "Invalid buffer_id."; 54 NOTREACHED() << "Invalid buffer_id.";
54 return false; 55 return false;
55 } 56 }
56 57
57 DCHECK(buffer->held_by_producer); 58 DCHECK(buffer->held_by_producer);
58 *memory = buffer->shared_memory.memory(); 59 *memory = buffer->shared_memory.memory();
59 *size = buffer->shared_memory.mapped_size(); 60 *size = buffer->shared_memory.mapped_size();
61 *handle = buffer->shared_memory.handle();
60 return true; 62 return true;
61 } 63 }
62 64
63 int VideoCaptureBufferPool::ReserveForProducer(size_t size, 65 int VideoCaptureBufferPool::ReserveForProducer(size_t size,
64 int* buffer_id_to_drop) { 66 int* buffer_id_to_drop) {
65 base::AutoLock lock(lock_); 67 base::AutoLock lock(lock_);
66 return ReserveForProducerInternal(size, buffer_id_to_drop); 68 return ReserveForProducerInternal(size, buffer_id_to_drop);
67 } 69 }
68 70
69 void VideoCaptureBufferPool::RelinquishProducerReservation(int buffer_id) { 71 void VideoCaptureBufferPool::RelinquishProducerReservation(int buffer_id) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 VideoCaptureBufferPool::Buffer* VideoCaptureBufferPool::GetBuffer( 165 VideoCaptureBufferPool::Buffer* VideoCaptureBufferPool::GetBuffer(
164 int buffer_id) { 166 int buffer_id) {
165 BufferMap::iterator it = buffers_.find(buffer_id); 167 BufferMap::iterator it = buffers_.find(buffer_id);
166 if (it == buffers_.end()) 168 if (it == buffers_.end())
167 return NULL; 169 return NULL;
168 return it->second; 170 return it->second;
169 } 171 }
170 172
171 } // namespace content 173 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698