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 <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 "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 13 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "ui/gfx/buffer_format_util.h" | 15 #include "ui/gfx/buffer_format_util.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 const int VideoCaptureBufferPool::kInvalidId = -1; | |
20 | |
21 // Tracker specifics for SharedMemory. | 19 // Tracker specifics for SharedMemory. |
22 class VideoCaptureBufferPool::SharedMemTracker final : public Tracker { | 20 class VideoCaptureBufferPoolImpl::SharedMemTracker final : public Tracker { |
23 public: | 21 public: |
24 SharedMemTracker() : Tracker() {} | 22 SharedMemTracker() : Tracker() {} |
25 | 23 |
26 bool Init(const gfx::Size& dimensions, | 24 bool Init(const gfx::Size& dimensions, |
27 media::VideoPixelFormat format, | 25 media::VideoPixelFormat format, |
28 media::VideoPixelStorage storage_type, | 26 media::VideoPixelStorage storage_type, |
29 base::Lock* lock) override { | 27 base::Lock* lock) override { |
30 DVLOG(2) << "allocating ShMem of " << dimensions.ToString(); | 28 DVLOG(2) << "allocating ShMem of " << dimensions.ToString(); |
31 set_dimensions(dimensions); | 29 set_dimensions(dimensions); |
32 // |dimensions| can be 0x0 for trackers that do not require memory backing. | 30 // |dimensions| can be 0x0 for trackers that do not require memory backing. |
(...skipping 18 matching lines...) Expand all Loading... |
51 bool ShareToProcess2(int plane, | 49 bool ShareToProcess2(int plane, |
52 base::ProcessHandle process_handle, | 50 base::ProcessHandle process_handle, |
53 gfx::GpuMemoryBufferHandle* new_handle) override { | 51 gfx::GpuMemoryBufferHandle* new_handle) override { |
54 NOTREACHED(); | 52 NOTREACHED(); |
55 return false; | 53 return false; |
56 } | 54 } |
57 | 55 |
58 private: | 56 private: |
59 // A simple proxy that implements the BufferHandle interface, providing | 57 // A simple proxy that implements the BufferHandle interface, providing |
60 // accessors to SharedMemTracker's memory and properties. | 58 // accessors to SharedMemTracker's memory and properties. |
61 class SharedMemBufferHandle : public VideoCaptureBufferPool::BufferHandle { | 59 class SharedMemBufferHandle |
| 60 : public VideoCaptureBufferPoolImpl::BufferHandle { |
62 public: | 61 public: |
63 // |tracker| must outlive SimpleBufferHandle. This is ensured since a | 62 // |tracker| must outlive SimpleBufferHandle. This is ensured since a |
64 // tracker is pinned until ownership of this SimpleBufferHandle is returned | 63 // tracker is pinned until ownership of this SimpleBufferHandle is returned |
65 // to VideoCaptureBufferPool. | 64 // to VideoCaptureBufferPoolImpl. |
66 explicit SharedMemBufferHandle(SharedMemTracker* tracker) | 65 explicit SharedMemBufferHandle(SharedMemTracker* tracker) |
67 : tracker_(tracker) {} | 66 : tracker_(tracker) {} |
68 ~SharedMemBufferHandle() override {} | 67 ~SharedMemBufferHandle() override {} |
69 | 68 |
70 gfx::Size dimensions() const override { return tracker_->dimensions(); } | 69 gfx::Size dimensions() const override { return tracker_->dimensions(); } |
71 size_t mapped_size() const override { return tracker_->mapped_size_; } | 70 size_t mapped_size() const override { return tracker_->mapped_size_; } |
72 void* data(int plane) override { | 71 void* data(int plane) override { |
73 DCHECK_EQ(plane, 0); | 72 DCHECK_EQ(plane, 0); |
74 return tracker_->shared_memory_.memory(); | 73 return tracker_->shared_memory_.memory(); |
75 } | 74 } |
(...skipping 11 matching lines...) Expand all Loading... |
87 SharedMemTracker* const tracker_; | 86 SharedMemTracker* const tracker_; |
88 }; | 87 }; |
89 | 88 |
90 // The memory created to be shared with renderer processes. | 89 // The memory created to be shared with renderer processes. |
91 base::SharedMemory shared_memory_; | 90 base::SharedMemory shared_memory_; |
92 size_t mapped_size_; | 91 size_t mapped_size_; |
93 }; | 92 }; |
94 | 93 |
95 // Tracker specifics for GpuMemoryBuffer. Owns GpuMemoryBuffers and its | 94 // Tracker specifics for GpuMemoryBuffer. Owns GpuMemoryBuffers and its |
96 // associated pixel dimensions. | 95 // associated pixel dimensions. |
97 class VideoCaptureBufferPool::GpuMemoryBufferTracker final : public Tracker { | 96 class VideoCaptureBufferPoolImpl::GpuMemoryBufferTracker final |
| 97 : public Tracker { |
98 public: | 98 public: |
99 GpuMemoryBufferTracker() : Tracker() {} | 99 GpuMemoryBufferTracker() : Tracker() {} |
100 | 100 |
101 ~GpuMemoryBufferTracker() override { | 101 ~GpuMemoryBufferTracker() override { |
102 for (const auto& gmb : gpu_memory_buffers_) | 102 for (const auto& gmb : gpu_memory_buffers_) |
103 gmb->Unmap(); | 103 gmb->Unmap(); |
104 } | 104 } |
105 | 105 |
106 bool Init(const gfx::Size& dimensions, | 106 bool Init(const gfx::Size& dimensions, |
107 media::VideoPixelFormat format, | 107 media::VideoPixelFormat format, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return true; | 180 return true; |
181 } | 181 } |
182 NOTREACHED(); | 182 NOTREACHED(); |
183 return true; | 183 return true; |
184 } | 184 } |
185 | 185 |
186 private: | 186 private: |
187 // A simple proxy that implements the BufferHandle interface, providing | 187 // A simple proxy that implements the BufferHandle interface, providing |
188 // accessors to GpuMemoryBufferTracker's memory and properties. | 188 // accessors to GpuMemoryBufferTracker's memory and properties. |
189 class GpuMemoryBufferBufferHandle | 189 class GpuMemoryBufferBufferHandle |
190 : public VideoCaptureBufferPool::BufferHandle { | 190 : public VideoCaptureBufferPoolImpl::BufferHandle { |
191 public: | 191 public: |
192 // |tracker| must outlive GpuMemoryBufferBufferHandle. This is ensured since | 192 // |tracker| must outlive GpuMemoryBufferBufferHandle. This is ensured since |
193 // a tracker is pinned until ownership of this GpuMemoryBufferBufferHandle | 193 // a tracker is pinned until ownership of this GpuMemoryBufferBufferHandle |
194 // is returned to VideoCaptureBufferPool. | 194 // is returned to VideoCaptureBufferPoolImpl. |
195 explicit GpuMemoryBufferBufferHandle(GpuMemoryBufferTracker* tracker) | 195 explicit GpuMemoryBufferBufferHandle(GpuMemoryBufferTracker* tracker) |
196 : tracker_(tracker) {} | 196 : tracker_(tracker) {} |
197 ~GpuMemoryBufferBufferHandle() override {} | 197 ~GpuMemoryBufferBufferHandle() override {} |
198 | 198 |
199 gfx::Size dimensions() const override { return tracker_->dimensions(); } | 199 gfx::Size dimensions() const override { return tracker_->dimensions(); } |
200 size_t mapped_size() const override { | 200 size_t mapped_size() const override { |
201 return tracker_->dimensions().GetArea(); | 201 return tracker_->dimensions().GetArea(); |
202 } | 202 } |
203 void* data(int plane) override { | 203 void* data(int plane) override { |
204 DCHECK_GE(plane, 0); | 204 DCHECK_GE(plane, 0); |
(...skipping 15 matching lines...) Expand all Loading... |
220 | 220 |
221 private: | 221 private: |
222 GpuMemoryBufferTracker* const tracker_; | 222 GpuMemoryBufferTracker* const tracker_; |
223 }; | 223 }; |
224 | 224 |
225 // Owned references to GpuMemoryBuffers. | 225 // Owned references to GpuMemoryBuffers. |
226 std::vector<std::unique_ptr<gfx::GpuMemoryBuffer>> gpu_memory_buffers_; | 226 std::vector<std::unique_ptr<gfx::GpuMemoryBuffer>> gpu_memory_buffers_; |
227 }; | 227 }; |
228 | 228 |
229 // static | 229 // static |
230 std::unique_ptr<VideoCaptureBufferPool::Tracker> | 230 std::unique_ptr<VideoCaptureBufferPoolImpl::Tracker> |
231 VideoCaptureBufferPool::Tracker::CreateTracker( | 231 VideoCaptureBufferPoolImpl::Tracker::CreateTracker( |
232 media::VideoPixelStorage storage) { | 232 media::VideoPixelStorage storage) { |
233 switch (storage) { | 233 switch (storage) { |
234 case media::PIXEL_STORAGE_GPUMEMORYBUFFER: | 234 case media::PIXEL_STORAGE_GPUMEMORYBUFFER: |
235 return base::MakeUnique<GpuMemoryBufferTracker>(); | 235 return base::MakeUnique<GpuMemoryBufferTracker>(); |
236 case media::PIXEL_STORAGE_CPU: | 236 case media::PIXEL_STORAGE_CPU: |
237 return base::MakeUnique<SharedMemTracker>(); | 237 return base::MakeUnique<SharedMemTracker>(); |
238 } | 238 } |
239 NOTREACHED(); | 239 NOTREACHED(); |
240 return std::unique_ptr<VideoCaptureBufferPool::Tracker>(); | 240 return std::unique_ptr<VideoCaptureBufferPoolImpl::Tracker>(); |
241 } | 241 } |
242 | 242 |
243 VideoCaptureBufferPool::Tracker::~Tracker() {} | 243 VideoCaptureBufferPoolImpl::Tracker::~Tracker() {} |
244 | 244 |
245 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) | 245 VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl(int count) |
246 : count_(count), | 246 : count_(count), |
247 next_buffer_id_(0), | 247 next_buffer_id_(0), |
248 last_relinquished_buffer_id_(kInvalidId) { | 248 last_relinquished_buffer_id_(kInvalidId) { |
249 DCHECK_GT(count, 0); | 249 DCHECK_GT(count, 0); |
250 } | 250 } |
251 | 251 |
252 VideoCaptureBufferPool::~VideoCaptureBufferPool() { | 252 VideoCaptureBufferPoolImpl::~VideoCaptureBufferPoolImpl() { |
253 base::STLDeleteValues(&trackers_); | 253 base::STLDeleteValues(&trackers_); |
254 } | 254 } |
255 | 255 |
256 bool VideoCaptureBufferPool::ShareToProcess( | 256 bool VideoCaptureBufferPoolImpl::ShareToProcess( |
257 int buffer_id, | 257 int buffer_id, |
258 base::ProcessHandle process_handle, | 258 base::ProcessHandle process_handle, |
259 base::SharedMemoryHandle* new_handle) { | 259 base::SharedMemoryHandle* new_handle) { |
260 base::AutoLock lock(lock_); | 260 base::AutoLock lock(lock_); |
261 | 261 |
262 Tracker* tracker = GetTracker(buffer_id); | 262 Tracker* tracker = GetTracker(buffer_id); |
263 if (!tracker) { | 263 if (!tracker) { |
264 NOTREACHED() << "Invalid buffer_id."; | 264 NOTREACHED() << "Invalid buffer_id."; |
265 return false; | 265 return false; |
266 } | 266 } |
267 if (tracker->ShareToProcess(process_handle, new_handle)) | 267 if (tracker->ShareToProcess(process_handle, new_handle)) |
268 return true; | 268 return true; |
269 DPLOG(ERROR) << "Error mapping memory"; | 269 DPLOG(ERROR) << "Error mapping memory"; |
270 return false; | 270 return false; |
271 } | 271 } |
272 | 272 |
273 bool VideoCaptureBufferPool::ShareToProcess2( | 273 bool VideoCaptureBufferPoolImpl::ShareToProcess2( |
274 int buffer_id, | 274 int buffer_id, |
275 int plane, | 275 int plane, |
276 base::ProcessHandle process_handle, | 276 base::ProcessHandle process_handle, |
277 gfx::GpuMemoryBufferHandle* new_handle) { | 277 gfx::GpuMemoryBufferHandle* new_handle) { |
278 base::AutoLock lock(lock_); | 278 base::AutoLock lock(lock_); |
279 | 279 |
280 Tracker* tracker = GetTracker(buffer_id); | 280 Tracker* tracker = GetTracker(buffer_id); |
281 if (!tracker) { | 281 if (!tracker) { |
282 NOTREACHED() << "Invalid buffer_id."; | 282 NOTREACHED() << "Invalid buffer_id."; |
283 return false; | 283 return false; |
284 } | 284 } |
285 if (tracker->ShareToProcess2(plane, process_handle, new_handle)) | 285 if (tracker->ShareToProcess2(plane, process_handle, new_handle)) |
286 return true; | 286 return true; |
287 DPLOG(ERROR) << "Error mapping memory"; | 287 DPLOG(ERROR) << "Error mapping memory"; |
288 return false; | 288 return false; |
289 } | 289 } |
290 | 290 |
291 std::unique_ptr<VideoCaptureBufferPool::BufferHandle> | 291 std::unique_ptr<VideoCaptureBufferPoolImpl::BufferHandle> |
292 VideoCaptureBufferPool::GetBufferHandle(int buffer_id) { | 292 VideoCaptureBufferPoolImpl::GetBufferHandle(int buffer_id) { |
293 base::AutoLock lock(lock_); | 293 base::AutoLock lock(lock_); |
294 | 294 |
295 Tracker* tracker = GetTracker(buffer_id); | 295 Tracker* tracker = GetTracker(buffer_id); |
296 if (!tracker) { | 296 if (!tracker) { |
297 NOTREACHED() << "Invalid buffer_id."; | 297 NOTREACHED() << "Invalid buffer_id."; |
298 return std::unique_ptr<BufferHandle>(); | 298 return std::unique_ptr<BufferHandle>(); |
299 } | 299 } |
300 | 300 |
301 DCHECK(tracker->held_by_producer()); | 301 DCHECK(tracker->held_by_producer()); |
302 return tracker->GetBufferHandle(); | 302 return tracker->GetBufferHandle(); |
303 } | 303 } |
304 | 304 |
305 int VideoCaptureBufferPool::ReserveForProducer(const gfx::Size& dimensions, | 305 int VideoCaptureBufferPoolImpl::ReserveForProducer( |
306 media::VideoPixelFormat format, | 306 const gfx::Size& dimensions, |
307 media::VideoPixelStorage storage, | 307 media::VideoPixelFormat format, |
308 int* buffer_id_to_drop) { | 308 media::VideoPixelStorage storage, |
| 309 int* buffer_id_to_drop) { |
309 base::AutoLock lock(lock_); | 310 base::AutoLock lock(lock_); |
310 return ReserveForProducerInternal(dimensions, format, storage, | 311 return ReserveForProducerInternal(dimensions, format, storage, |
311 buffer_id_to_drop); | 312 buffer_id_to_drop); |
312 } | 313 } |
313 | 314 |
314 void VideoCaptureBufferPool::RelinquishProducerReservation(int buffer_id) { | 315 void VideoCaptureBufferPoolImpl::RelinquishProducerReservation(int buffer_id) { |
315 base::AutoLock lock(lock_); | 316 base::AutoLock lock(lock_); |
316 Tracker* tracker = GetTracker(buffer_id); | 317 Tracker* tracker = GetTracker(buffer_id); |
317 if (!tracker) { | 318 if (!tracker) { |
318 NOTREACHED() << "Invalid buffer_id."; | 319 NOTREACHED() << "Invalid buffer_id."; |
319 return; | 320 return; |
320 } | 321 } |
321 DCHECK(tracker->held_by_producer()); | 322 DCHECK(tracker->held_by_producer()); |
322 tracker->set_held_by_producer(false); | 323 tracker->set_held_by_producer(false); |
323 last_relinquished_buffer_id_ = buffer_id; | 324 last_relinquished_buffer_id_ = buffer_id; |
324 } | 325 } |
325 | 326 |
326 void VideoCaptureBufferPool::HoldForConsumers( | 327 void VideoCaptureBufferPoolImpl::HoldForConsumers(int buffer_id, |
327 int buffer_id, | 328 int num_clients) { |
328 int num_clients) { | |
329 base::AutoLock lock(lock_); | 329 base::AutoLock lock(lock_); |
330 Tracker* tracker = GetTracker(buffer_id); | 330 Tracker* tracker = GetTracker(buffer_id); |
331 if (!tracker) { | 331 if (!tracker) { |
332 NOTREACHED() << "Invalid buffer_id."; | 332 NOTREACHED() << "Invalid buffer_id."; |
333 return; | 333 return; |
334 } | 334 } |
335 DCHECK(tracker->held_by_producer()); | 335 DCHECK(tracker->held_by_producer()); |
336 DCHECK(!tracker->consumer_hold_count()); | 336 DCHECK(!tracker->consumer_hold_count()); |
337 | 337 |
338 tracker->set_consumer_hold_count(num_clients); | 338 tracker->set_consumer_hold_count(num_clients); |
339 // Note: |held_by_producer()| will stay true until | 339 // Note: |held_by_producer()| will stay true until |
340 // RelinquishProducerReservation() (usually called by destructor of the object | 340 // RelinquishProducerReservation() (usually called by destructor of the object |
341 // wrapping this tracker, e.g. a media::VideoFrame). | 341 // wrapping this tracker, e.g. a media::VideoFrame). |
342 } | 342 } |
343 | 343 |
344 void VideoCaptureBufferPool::RelinquishConsumerHold(int buffer_id, | 344 void VideoCaptureBufferPoolImpl::RelinquishConsumerHold(int buffer_id, |
345 int num_clients) { | 345 int num_clients) { |
346 base::AutoLock lock(lock_); | 346 base::AutoLock lock(lock_); |
347 Tracker* tracker = GetTracker(buffer_id); | 347 Tracker* tracker = GetTracker(buffer_id); |
348 if (!tracker) { | 348 if (!tracker) { |
349 NOTREACHED() << "Invalid buffer_id."; | 349 NOTREACHED() << "Invalid buffer_id."; |
350 return; | 350 return; |
351 } | 351 } |
352 DCHECK_GE(tracker->consumer_hold_count(), num_clients); | 352 DCHECK_GE(tracker->consumer_hold_count(), num_clients); |
353 | 353 |
354 tracker->set_consumer_hold_count(tracker->consumer_hold_count() - | 354 tracker->set_consumer_hold_count(tracker->consumer_hold_count() - |
355 num_clients); | 355 num_clients); |
356 } | 356 } |
357 | 357 |
358 int VideoCaptureBufferPool::ResurrectLastForProducer( | 358 int VideoCaptureBufferPoolImpl::ResurrectLastForProducer( |
359 const gfx::Size& dimensions, | 359 const gfx::Size& dimensions, |
360 media::VideoPixelFormat format, | 360 media::VideoPixelFormat format, |
361 media::VideoPixelStorage storage) { | 361 media::VideoPixelStorage storage) { |
362 base::AutoLock lock(lock_); | 362 base::AutoLock lock(lock_); |
363 | 363 |
364 // Return early if the last relinquished buffer has been re-used already. | 364 // Return early if the last relinquished buffer has been re-used already. |
365 if (last_relinquished_buffer_id_ == kInvalidId) | 365 if (last_relinquished_buffer_id_ == kInvalidId) |
366 return kInvalidId; | 366 return kInvalidId; |
367 | 367 |
368 // If there are no consumers reading from this buffer, then it's safe to | 368 // If there are no consumers reading from this buffer, then it's safe to |
369 // provide this buffer back to the producer (because the producer may | 369 // provide this buffer back to the producer (because the producer may |
370 // potentially modify the content). Check that the expected dimensions, | 370 // potentially modify the content). Check that the expected dimensions, |
371 // format, and storage match. | 371 // format, and storage match. |
372 TrackerMap::iterator it = trackers_.find(last_relinquished_buffer_id_); | 372 TrackerMap::iterator it = trackers_.find(last_relinquished_buffer_id_); |
373 DCHECK(it != trackers_.end()); | 373 DCHECK(it != trackers_.end()); |
374 DCHECK(!it->second->held_by_producer()); | 374 DCHECK(!it->second->held_by_producer()); |
375 if (it->second->consumer_hold_count() == 0 && | 375 if (it->second->consumer_hold_count() == 0 && |
376 it->second->dimensions() == dimensions && | 376 it->second->dimensions() == dimensions && |
377 it->second->pixel_format() == format && | 377 it->second->pixel_format() == format && |
378 it->second->storage_type() == storage) { | 378 it->second->storage_type() == storage) { |
379 it->second->set_held_by_producer(true); | 379 it->second->set_held_by_producer(true); |
380 const int resurrected_buffer_id = last_relinquished_buffer_id_; | 380 const int resurrected_buffer_id = last_relinquished_buffer_id_; |
381 last_relinquished_buffer_id_ = kInvalidId; | 381 last_relinquished_buffer_id_ = kInvalidId; |
382 return resurrected_buffer_id; | 382 return resurrected_buffer_id; |
383 } | 383 } |
384 | 384 |
385 return kInvalidId; | 385 return kInvalidId; |
386 } | 386 } |
387 | 387 |
388 double VideoCaptureBufferPool::GetBufferPoolUtilization() const { | 388 double VideoCaptureBufferPoolImpl::GetBufferPoolUtilization() const { |
389 base::AutoLock lock(lock_); | 389 base::AutoLock lock(lock_); |
390 int num_buffers_held = 0; | 390 int num_buffers_held = 0; |
391 for (const auto& entry : trackers_) { | 391 for (const auto& entry : trackers_) { |
392 Tracker* const tracker = entry.second; | 392 Tracker* const tracker = entry.second; |
393 if (tracker->held_by_producer() || tracker->consumer_hold_count() > 0) | 393 if (tracker->held_by_producer() || tracker->consumer_hold_count() > 0) |
394 ++num_buffers_held; | 394 ++num_buffers_held; |
395 } | 395 } |
396 return static_cast<double>(num_buffers_held) / count_; | 396 return static_cast<double>(num_buffers_held) / count_; |
397 } | 397 } |
398 | 398 |
399 int VideoCaptureBufferPool::ReserveForProducerInternal( | 399 int VideoCaptureBufferPoolImpl::ReserveForProducerInternal( |
400 const gfx::Size& dimensions, | 400 const gfx::Size& dimensions, |
401 media::VideoPixelFormat pixel_format, | 401 media::VideoPixelFormat pixel_format, |
402 media::VideoPixelStorage storage_type, | 402 media::VideoPixelStorage storage_type, |
403 int* buffer_id_to_drop) { | 403 int* buffer_id_to_drop) { |
404 lock_.AssertAcquired(); | 404 lock_.AssertAcquired(); |
405 | 405 |
406 const size_t size_in_pixels = dimensions.GetArea(); | 406 const size_t size_in_pixels = dimensions.GetArea(); |
407 // Look for a tracker that's allocated, big enough, and not in use. Track the | 407 // Look for a tracker that's allocated, big enough, and not in use. Track the |
408 // largest one that's not big enough, in case we have to reallocate a tracker. | 408 // largest one that's not big enough, in case we have to reallocate a tracker. |
409 *buffer_id_to_drop = kInvalidId; | 409 *buffer_id_to_drop = kInvalidId; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 DLOG(ERROR) << "Error initializing Tracker"; | 467 DLOG(ERROR) << "Error initializing Tracker"; |
468 return kInvalidId; | 468 return kInvalidId; |
469 } | 469 } |
470 | 470 |
471 tracker->set_held_by_producer(true); | 471 tracker->set_held_by_producer(true); |
472 trackers_[buffer_id] = tracker.release(); | 472 trackers_[buffer_id] = tracker.release(); |
473 | 473 |
474 return buffer_id; | 474 return buffer_id; |
475 } | 475 } |
476 | 476 |
477 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( | 477 VideoCaptureBufferPoolImpl::Tracker* VideoCaptureBufferPoolImpl::GetTracker( |
478 int buffer_id) { | 478 int buffer_id) { |
479 TrackerMap::const_iterator it = trackers_.find(buffer_id); | 479 TrackerMap::const_iterator it = trackers_.find(buffer_id); |
480 return (it == trackers_.end()) ? NULL : it->second; | 480 return (it == trackers_.end()) ? NULL : it->second; |
481 } | 481 } |
482 | 482 |
483 } // namespace content | 483 } // namespace content |
OLD | NEW |