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 "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 10 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); | 174 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); |
175 DCHECK(BrowserGpuMemoryBufferManager::current()); | 175 DCHECK(BrowserGpuMemoryBufferManager::current()); |
176 set_pixel_format(format); | 176 set_pixel_format(format); |
177 set_storage_type(storage_type); | 177 set_storage_type(storage_type); |
178 set_pixel_count(dimensions.GetArea()); | 178 set_pixel_count(dimensions.GetArea()); |
179 // |dimensions| can be 0x0 for trackers that do not require memory backing. | 179 // |dimensions| can be 0x0 for trackers that do not require memory backing. |
180 if (dimensions.GetArea() == 0u) | 180 if (dimensions.GetArea() == 0u) |
181 return true; | 181 return true; |
182 gpu_memory_buffer_ = | 182 gpu_memory_buffer_ = |
183 BrowserGpuMemoryBufferManager::current()->AllocateGpuMemoryBuffer( | 183 BrowserGpuMemoryBufferManager::current()->AllocateGpuMemoryBuffer( |
184 dimensions, | 184 dimensions, gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP); |
185 gfx::GpuMemoryBuffer::BGRA_8888, | |
186 gfx::GpuMemoryBuffer::MAP); | |
187 DLOG_IF(ERROR, !gpu_memory_buffer_.get()) << "Allocating GpuMemoryBuffer"; | 185 DLOG_IF(ERROR, !gpu_memory_buffer_.get()) << "Allocating GpuMemoryBuffer"; |
188 if (!gpu_memory_buffer_.get()) | 186 if (!gpu_memory_buffer_.get()) |
189 return false; | 187 return false; |
190 int plane_sizes; | 188 int plane_sizes; |
191 gpu_memory_buffer_->GetStride(&plane_sizes); | 189 gpu_memory_buffer_->GetStride(&plane_sizes); |
192 packed_size_ = plane_sizes * dimensions.height(); | 190 packed_size_ = plane_sizes * dimensions.height(); |
193 return true; | 191 return true; |
194 } | 192 } |
195 | 193 |
196 // static | 194 // static |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 return buffer_id; | 369 return buffer_id; |
372 } | 370 } |
373 | 371 |
374 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( | 372 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( |
375 int buffer_id) { | 373 int buffer_id) { |
376 TrackerMap::const_iterator it = trackers_.find(buffer_id); | 374 TrackerMap::const_iterator it = trackers_.find(buffer_id); |
377 return (it == trackers_.end()) ? NULL : it->second; | 375 return (it == trackers_.end()) ? NULL : it->second; |
378 } | 376 } |
379 | 377 |
380 } // namespace content | 378 } // namespace content |
OLD | NEW |