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

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

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // 76 //
77 // If successful, the reserved buffer remains reserved (and writable by the 77 // If successful, the reserved buffer remains reserved (and writable by the
78 // producer) until ownership is transferred either to the consumer via 78 // producer) until ownership is transferred either to the consumer via
79 // HoldForConsumers(), or back to the pool with 79 // HoldForConsumers(), or back to the pool with
80 // RelinquishProducerReservation(). 80 // RelinquishProducerReservation().
81 // 81 //
82 // On occasion, this call will decide to free an old buffer to make room for a 82 // On occasion, this call will decide to free an old buffer to make room for a
83 // new allocation at a larger size. If so, the ID of the destroyed buffer is 83 // new allocation at a larger size. If so, the ID of the destroyed buffer is
84 // returned via |buffer_id_to_drop|. 84 // returned via |buffer_id_to_drop|.
85 int ReserveForProducer(media::VideoPixelFormat format, 85 int ReserveForProducer(media::VideoPixelFormat format,
86 media::VideoPixelStorage storage,
86 const gfx::Size& dimensions, 87 const gfx::Size& dimensions,
87 int* buffer_id_to_drop); 88 int* buffer_id_to_drop);
88 89
89 // Indicate that a buffer held for the producer should be returned back to the 90 // Indicate that a buffer held for the producer should be returned back to the
90 // pool without passing on to the consumer. This effectively is the opposite 91 // pool without passing on to the consumer. This effectively is the opposite
91 // of ReserveForProducer(). 92 // of ReserveForProducer().
92 void RelinquishProducerReservation(int buffer_id); 93 void RelinquishProducerReservation(int buffer_id);
93 94
94 // Transfer a buffer from producer to consumer ownership. 95 // Transfer a buffer from producer to consumer ownership.
95 // |buffer_id| must be a buffer index previously returned by 96 // |buffer_id| must be a buffer index previously returned by
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Indicates whether this Tracker is currently referenced by the producer. 151 // Indicates whether this Tracker is currently referenced by the producer.
151 bool held_by_producer_; 152 bool held_by_producer_;
152 // Number of consumer processes which hold this Tracker. 153 // Number of consumer processes which hold this Tracker.
153 int consumer_hold_count_; 154 int consumer_hold_count_;
154 }; 155 };
155 156
156 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>; 157 friend class base::RefCountedThreadSafe<VideoCaptureBufferPool>;
157 virtual ~VideoCaptureBufferPool(); 158 virtual ~VideoCaptureBufferPool();
158 159
159 int ReserveForProducerInternal(media::VideoPixelFormat format, 160 int ReserveForProducerInternal(media::VideoPixelFormat format,
161 media::VideoPixelStorage storage,
160 const gfx::Size& dimensions, 162 const gfx::Size& dimensions,
161 int* tracker_id_to_drop); 163 int* tracker_id_to_drop);
162 164
163 Tracker* GetTracker(int buffer_id); 165 Tracker* GetTracker(int buffer_id);
164 166
165 // The max number of buffers that the pool is allowed to have at any moment. 167 // The max number of buffers that the pool is allowed to have at any moment.
166 const int count_; 168 const int count_;
167 169
168 // Protects everything below it. 170 // Protects everything below it.
169 base::Lock lock_; 171 base::Lock lock_;
170 172
171 // The ID of the next buffer. 173 // The ID of the next buffer.
172 int next_buffer_id_; 174 int next_buffer_id_;
173 175
174 // The buffers, indexed by the first parameter, a buffer id. 176 // The buffers, indexed by the first parameter, a buffer id.
175 using TrackerMap = std::map<int, Tracker*>; 177 using TrackerMap = std::map<int, Tracker*>;
176 TrackerMap trackers_; 178 TrackerMap trackers_;
177 179
178 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool); 180 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureBufferPool);
179 }; 181 };
180 182
181 } // namespace content 183 } // namespace content
182 184
183 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_ 185 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_BUFFER_POOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698