| 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/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 return true; | 253 return true; |
| 254 } | 254 } |
| 255 NOTREACHED(); | 255 NOTREACHED(); |
| 256 return true; | 256 return true; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // static | 259 // static |
| 260 scoped_ptr<VideoCaptureBufferPool::Tracker> | 260 scoped_ptr<VideoCaptureBufferPool::Tracker> |
| 261 VideoCaptureBufferPool::Tracker::CreateTracker( | 261 VideoCaptureBufferPool::Tracker::CreateTracker( |
| 262 media::VideoPixelStorage storage) { | 262 media::VideoPixelStorage storage) { |
| 263 DCHECK(storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER || | 263 switch (storage) { |
| 264 storage == media::PIXEL_STORAGE_CPU || | 264 case media::PIXEL_STORAGE_GPUMEMORYBUFFER: |
| 265 storage == media::PIXEL_STORAGE_TEXTURE); | 265 return make_scoped_ptr(new GpuMemoryBufferTracker()); |
| 266 | 266 case media::PIXEL_STORAGE_CPU: |
| 267 if (storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER) | 267 return make_scoped_ptr(new SharedMemTracker()); |
| 268 return make_scoped_ptr(new GpuMemoryBufferTracker()); | 268 } |
| 269 else | 269 NOTREACHED(); |
| 270 return make_scoped_ptr(new SharedMemTracker()); | 270 return scoped_ptr<VideoCaptureBufferPool::Tracker>(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 VideoCaptureBufferPool::Tracker::~Tracker() {} | 273 VideoCaptureBufferPool::Tracker::~Tracker() {} |
| 274 | 274 |
| 275 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) | 275 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) |
| 276 : count_(count), | 276 : count_(count), |
| 277 next_buffer_id_(0) { | 277 next_buffer_id_(0) { |
| 278 DCHECK_GT(count, 0); | 278 DCHECK_GT(count, 0); |
| 279 } | 279 } |
| 280 | 280 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 return buffer_id; | 455 return buffer_id; |
| 456 } | 456 } |
| 457 | 457 |
| 458 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( | 458 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( |
| 459 int buffer_id) { | 459 int buffer_id) { |
| 460 TrackerMap::const_iterator it = trackers_.find(buffer_id); | 460 TrackerMap::const_iterator it = trackers_.find(buffer_id); |
| 461 return (it == trackers_.end()) ? NULL : it->second; | 461 return (it == trackers_.end()) ? NULL : it->second; |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace content | 464 } // namespace content |
| OLD | NEW |