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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // potentially modify the content). Check that the expected dimensions, | 367 // potentially modify the content). Check that the expected dimensions, |
368 // format, and storage match. | 368 // format, and storage match. |
369 TrackerMap::iterator it = trackers_.find(last_relinquished_buffer_id_); | 369 TrackerMap::iterator it = trackers_.find(last_relinquished_buffer_id_); |
370 DCHECK(it != trackers_.end()); | 370 DCHECK(it != trackers_.end()); |
371 DCHECK(!it->second->held_by_producer()); | 371 DCHECK(!it->second->held_by_producer()); |
372 if (it->second->consumer_hold_count() == 0 && | 372 if (it->second->consumer_hold_count() == 0 && |
373 it->second->dimensions() == dimensions && | 373 it->second->dimensions() == dimensions && |
374 it->second->pixel_format() == format && | 374 it->second->pixel_format() == format && |
375 it->second->storage_type() == storage) { | 375 it->second->storage_type() == storage) { |
376 it->second->set_held_by_producer(true); | 376 it->second->set_held_by_producer(true); |
377 const int resurrected_buffer_id = last_relinquished_buffer_id_; | 377 return last_relinquished_buffer_id_; |
378 last_relinquished_buffer_id_ = kInvalidId; | |
379 return resurrected_buffer_id; | |
380 } | 378 } |
381 | 379 |
382 return kInvalidId; | 380 return kInvalidId; |
383 } | 381 } |
384 | 382 |
385 double VideoCaptureBufferPool::GetBufferPoolUtilization() const { | 383 double VideoCaptureBufferPool::GetBufferPoolUtilization() const { |
386 base::AutoLock lock(lock_); | 384 base::AutoLock lock(lock_); |
387 int num_buffers_held = 0; | 385 int num_buffers_held = 0; |
388 for (const auto& entry : trackers_) { | 386 for (const auto& entry : trackers_) { |
389 Tracker* const tracker = entry.second; | 387 Tracker* const tracker = entry.second; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 return buffer_id; | 469 return buffer_id; |
472 } | 470 } |
473 | 471 |
474 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( | 472 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( |
475 int buffer_id) { | 473 int buffer_id) { |
476 TrackerMap::const_iterator it = trackers_.find(buffer_id); | 474 TrackerMap::const_iterator it = trackers_.find(buffer_id); |
477 return (it == trackers_.end()) ? NULL : it->second; | 475 return (it == trackers_.end()) ? NULL : it->second; |
478 } | 476 } |
479 | 477 |
480 } // namespace content | 478 } // namespace content |
OLD | NEW |