| 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 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 5 #ifndef MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 6 #define MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // Reserve output buffer into which I420 contents can be copied directly. | 80 // Reserve output buffer into which I420 contents can be copied directly. |
| 81 // The dimensions of the frame is described by |dimensions|, and requested | 81 // The dimensions of the frame is described by |dimensions|, and requested |
| 82 // output buffer format is specified by |storage|. The reserved output buffer | 82 // output buffer format is specified by |storage|. The reserved output buffer |
| 83 // is returned; and the pointer to Y plane is stored at [y_plane_data], U | 83 // is returned; and the pointer to Y plane is stored at [y_plane_data], U |
| 84 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data]. | 84 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data]. |
| 85 // Returns an nullptr if allocation fails. | 85 // Returns an nullptr if allocation fails. |
| 86 // | 86 // |
| 87 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory | 87 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory |
| 88 // chunk is reserved; whereas for PIXEL_STORAGE_GPUMEMORYBUFFER, three | 88 // chunk is reserved. The output buffers stay reserved and mapped for use |
| 89 // GpuMemoryBuffers in R_8 format representing I420 planes are reserved. The | 89 // until the Buffer objects are destroyed or returned. |
| 90 // output buffers stay reserved and mapped for use until the Buffer objects | |
| 91 // are destroyed or returned. | |
| 92 std::unique_ptr<Buffer> ReserveI420OutputBuffer( | 90 std::unique_ptr<Buffer> ReserveI420OutputBuffer( |
| 93 const gfx::Size& dimensions, | 91 const gfx::Size& dimensions, |
| 94 media::VideoPixelStorage storage, | 92 media::VideoPixelStorage storage, |
| 95 uint8_t** y_plane_data, | 93 uint8_t** y_plane_data, |
| 96 uint8_t** u_plane_data, | 94 uint8_t** u_plane_data, |
| 97 uint8_t** v_plane_data); | 95 uint8_t** v_plane_data); |
| 98 | 96 |
| 99 // The receiver to which we post events. | 97 // The receiver to which we post events. |
| 100 const std::unique_ptr<VideoFrameReceiver> receiver_; | 98 const std::unique_ptr<VideoFrameReceiver> receiver_; |
| 101 | 99 |
| 102 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 100 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |
| 103 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; | 101 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; |
| 104 | 102 |
| 105 // Whether |external_jpeg_decoder_| has been initialized. | 103 // Whether |external_jpeg_decoder_| has been initialized. |
| 106 bool external_jpeg_decoder_initialized_; | 104 bool external_jpeg_decoder_initialized_; |
| 107 | 105 |
| 108 // The pool of shared-memory buffers used for capturing. | 106 // The pool of shared-memory buffers used for capturing. |
| 109 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 107 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| 110 | 108 |
| 111 #if DCHECK_IS_ON() | 109 #if DCHECK_IS_ON() |
| 112 // Counter used to track the number of times consecutive capture buffers are | 110 // Counter used to track the number of times consecutive capture buffers are |
| 113 // dropped. | 111 // dropped. |
| 114 int dropped_frame_counter_ = 0; | 112 int dropped_frame_counter_ = 0; |
| 115 | 113 |
| 116 static const int kMaxDroppedFrames = 150; | 114 static const int kMaxDroppedFrames = 150; |
| 117 #endif // DCHECK_IS_ON() | 115 #endif // DCHECK_IS_ON() |
| 118 | 116 |
| 119 // Indication to the Client to copy-transform the incoming data into | |
| 120 // GpuMemoryBuffers. | |
| 121 const bool use_gpu_memory_buffers_; | |
| 122 | |
| 123 media::VideoPixelFormat last_captured_pixel_format_; | 117 media::VideoPixelFormat last_captured_pixel_format_; |
| 124 | 118 |
| 125 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 119 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 126 }; | 120 }; |
| 127 | 121 |
| 128 } // namespace media | 122 } // namespace media |
| 129 | 123 |
| 130 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 124 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| OLD | NEW |