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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "content/browser/renderer_host/media/video_capture_buffer_handle.h" |
17 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 18 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
18 #include "content/browser/renderer_host/media/video_capture_controller.h" | 19 #include "content/browser/renderer_host/media/video_capture_controller.h" |
19 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 20 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
20 #include "media/base/bind_to_current_loop.h" | 21 #include "media/base/bind_to_current_loop.h" |
21 #include "media/base/media_switches.h" | 22 #include "media/base/media_switches.h" |
22 #include "media/base/video_capture_types.h" | 23 #include "media/base/video_capture_types.h" |
23 #include "media/base/video_frame.h" | 24 #include "media/base/video_frame.h" |
24 #include "third_party/libyuv/include/libyuv.h" | 25 #include "third_party/libyuv/include/libyuv.h" |
25 | 26 |
26 using media::VideoCaptureFormat; | 27 using media::VideoCaptureFormat; |
(...skipping 24 matching lines...) Expand all Loading... |
51 base::FileDescriptor AsPlatformFile() override { | 52 base::FileDescriptor AsPlatformFile() override { |
52 return buffer_handle_->AsPlatformFile(); | 53 return buffer_handle_->AsPlatformFile(); |
53 } | 54 } |
54 #endif | 55 #endif |
55 | 56 |
56 private: | 57 private: |
57 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } | 58 ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); } |
58 | 59 |
59 const int id_; | 60 const int id_; |
60 const scoped_refptr<VideoCaptureBufferPool> pool_; | 61 const scoped_refptr<VideoCaptureBufferPool> pool_; |
61 const std::unique_ptr<VideoCaptureBufferPoolBufferHandle> buffer_handle_; | 62 const std::unique_ptr<VideoCaptureBufferHandle> buffer_handle_; |
62 }; | 63 }; |
63 | 64 |
64 VideoCaptureDeviceClient::VideoCaptureDeviceClient( | 65 VideoCaptureDeviceClient::VideoCaptureDeviceClient( |
65 std::unique_ptr<VideoFrameReceiver> receiver, | 66 std::unique_ptr<VideoFrameReceiver> receiver, |
66 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool, | 67 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool, |
67 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory) | 68 const VideoCaptureJpegDecoderFactoryCB& jpeg_decoder_factory) |
68 : receiver_(std::move(receiver)), | 69 : receiver_(std::move(receiver)), |
69 jpeg_decoder_factory_callback_(jpeg_decoder_factory), | 70 jpeg_decoder_factory_callback_(jpeg_decoder_factory), |
70 external_jpeg_decoder_initialized_(false), | 71 external_jpeg_decoder_initialized_(false), |
71 buffer_pool_(buffer_pool), | 72 buffer_pool_(buffer_pool), |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); | 406 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); |
406 *v_plane_data = | 407 *v_plane_data = |
407 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); | 408 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); |
408 return buffer; | 409 return buffer; |
409 } | 410 } |
410 NOTREACHED(); | 411 NOTREACHED(); |
411 return std::unique_ptr<Buffer>(); | 412 return std::unique_ptr<Buffer>(); |
412 } | 413 } |
413 | 414 |
414 } // namespace content | 415 } // namespace content |
OLD | NEW |