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

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

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (hide change of base/containers/scoped_ptr_hash_map.h in https://codereview.chromium.org/1099383002… 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // One-time (per client/per-buffer) initialization to share a particular 49 // One-time (per client/per-buffer) initialization to share a particular
50 // buffer to a process. The size of the allocation is returned as 50 // buffer to a process. The size of the allocation is returned as
51 // |memory_size|. 51 // |memory_size|.
52 base::SharedMemoryHandle ShareToProcess(int buffer_id, 52 base::SharedMemoryHandle ShareToProcess(int buffer_id,
53 base::ProcessHandle process_handle, 53 base::ProcessHandle process_handle,
54 size_t* memory_size); 54 size_t* memory_size);
55 55
56 // Query the memory parameters of |buffer_id|. Fills in parameters in the 56 // Query the memory parameters of |buffer_id|. Fills in parameters in the
57 // pointer arguments, and returns true iff the buffer exists. 57 // pointer arguments, and returns true iff the buffer exists.
58 bool GetBufferInfo(int buffer_id, void** storage, size_t* size); 58 bool GetBufferInfo(int buffer_id,
59 void** storage,
60 size_t* size,
61 base::SharedMemoryHandle* handle);
mcasas 2015/04/28 00:04:50 You'll have to rebase this area quite a bit. Basic
kcwu 2015/04/30 19:25:43 Done. Thanks for your kind help. Please take a loo
59 62
60 // Reserve or allocate a buffer to support a packed frame of |dimensions| of 63 // Reserve or allocate a buffer to support a packed frame of |dimensions| of
61 // pixel |format| and return its id. This will fail (returning kInvalidId) if 64 // pixel |format| and return its id. This will fail (returning kInvalidId) if
62 // the pool already is at its |count| limit of the number of allocations, and 65 // the pool already is at its |count| limit of the number of allocations, and
63 // all allocated buffers are in use by the producer and/or consumers. 66 // all allocated buffers are in use by the producer and/or consumers.
64 // 67 //
65 // If successful, the reserved buffer remains reserved (and writable by the 68 // If successful, the reserved buffer remains reserved (and writable by the
66 // producer) until ownership is transferred either to the consumer via 69 // producer) until ownership is transferred either to the consumer via
67 // HoldForConsumers(), or back to the pool with 70 // HoldForConsumers(), or back to the pool with
68 // RelinquishProducerReservation(). 71 // RelinquishProducerReservation().
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void set_consumer_hold_count(int value) { consumer_hold_count_ = value; } 110 void set_consumer_hold_count(int value) { consumer_hold_count_ = value; }
108 111
109 // Returns a void* to the underlying storage, be that a memory block for 112 // Returns a void* to the underlying storage, be that a memory block for
110 // Shared Memory, or a GpuMemoryBuffer. 113 // Shared Memory, or a GpuMemoryBuffer.
111 virtual void* storage() = 0; 114 virtual void* storage() = 0;
112 // Amount of bytes requested when first created. Can be zero if it does not 115 // Amount of bytes requested when first created. Can be zero if it does not
113 // need RAM, e.g. is allocated in GPU memory. 116 // need RAM, e.g. is allocated in GPU memory.
114 virtual size_t requested_size() = 0; 117 virtual size_t requested_size() = 0;
115 // The actual size of the underlying backing resource. 118 // The actual size of the underlying backing resource.
116 virtual size_t mapped_size() = 0; 119 virtual size_t mapped_size() = 0;
120 virtual base::SharedMemoryHandle handle() = 0;
117 121
118 virtual bool ShareToProcess(base::ProcessHandle process_handle, 122 virtual bool ShareToProcess(base::ProcessHandle process_handle,
119 base::SharedMemoryHandle* new_handle) = 0; 123 base::SharedMemoryHandle* new_handle) = 0;
120 124
121 private: 125 private:
122 // Indicates whether this Tracker is currently referenced by the producer. 126 // Indicates whether this Tracker is currently referenced by the producer.
123 bool held_by_producer_; 127 bool held_by_producer_;
124 // Number of consumer processes which hold this Tracker. 128 // Number of consumer processes which hold this Tracker.
125 int consumer_hold_count_; 129 int consumer_hold_count_;
126 }; 130 };
(...skipping 19 matching lines...) Expand all
146 // The buffers, indexed by the first parameter, a buffer id. 150 // The buffers, indexed by the first parameter, a buffer id.
147 using TrackerMap = std::map<int, Tracker*>; 151 using TrackerMap = std::map<int, Tracker*>;
148 TrackerMap trackers_; 152 TrackerMap trackers_;
149 153
150 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool); 154 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool);
151 }; 155 };
152 156
153 } // namespace content 157 } // namespace content
154 158
155 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ 159 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698