OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_device_client.h" | 5 #include "content/browser/renderer_host/media/video_capture_device_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #endif | 62 #endif |
63 | 63 |
64 private: | 64 private: |
65 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } | 65 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } |
66 | 66 |
67 const int id_; | 67 const int id_; |
68 const scoped_refptr<VideoCaptureBufferPool> pool_; | 68 const scoped_refptr<VideoCaptureBufferPool> pool_; |
69 const scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle_; | 69 const scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle_; |
70 }; | 70 }; |
71 | 71 |
| 72 |
| 73 |
72 VideoCaptureDeviceClient::VideoCaptureDeviceClient( | 74 VideoCaptureDeviceClient::VideoCaptureDeviceClient( |
73 const base::WeakPtr<VideoCaptureController>& controller, | 75 const base::WeakPtr<VideoCaptureController>& controller, |
74 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool) | 76 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool) |
75 : controller_(controller), | 77 : controller_(controller), |
76 external_jpeg_decoder_initialized_(false), | 78 external_jpeg_decoder_initialized_(false), |
77 buffer_pool_(buffer_pool), | 79 buffer_pool_(buffer_pool), |
78 use_gpu_memory_buffers_(base::CommandLine::ForCurrentProcess()->HasSwitch( | 80 use_gpu_memory_buffers_(base::CommandLine::ForCurrentProcess()->HasSwitch( |
79 switches::kUseGpuMemoryBuffersForCapture)), | 81 switches::kUseGpuMemoryBuffersForCapture)), |
80 last_captured_pixel_format_(media::PIXEL_FORMAT_UNKNOWN) { | 82 last_captured_pixel_format_(media::PIXEL_FORMAT_UNKNOWN) { |
81 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 83 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 VideoFrame::PlaneSize(format, VideoFrame::kUPlane, dimensions) | 451 VideoFrame::PlaneSize(format, VideoFrame::kUPlane, dimensions) |
450 .GetArea(); | 452 .GetArea(); |
451 } else if (storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER) { | 453 } else if (storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER) { |
452 *y_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kYPlane)); | 454 *y_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kYPlane)); |
453 *u_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); | 455 *u_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); |
454 *v_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); | 456 *v_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); |
455 } | 457 } |
456 return buffer.Pass(); | 458 return buffer.Pass(); |
457 } | 459 } |
458 | 460 |
| 461 |
| 462 |
| 463 |
459 } // namespace content | 464 } // namespace content |
OLD | NEW |