| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 std::unique_ptr<Buffer> buffer, | 68 std::unique_ptr<Buffer> buffer, |
| 69 const scoped_refptr<media::VideoFrame>& frame) override; | 69 const scoped_refptr<media::VideoFrame>& frame) override; |
| 70 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 70 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
| 71 const gfx::Size& dimensions, | 71 const gfx::Size& dimensions, |
| 72 media::VideoPixelFormat format, | 72 media::VideoPixelFormat format, |
| 73 media::VideoPixelStorage storage) override; | 73 media::VideoPixelStorage storage) override; |
| 74 void OnError(const tracked_objects::Location& from_here, | 74 void OnError(const tracked_objects::Location& from_here, |
| 75 const std::string& reason) override; | 75 const std::string& reason) override; |
| 76 void OnLog(const std::string& message) override; | 76 void OnLog(const std::string& message) override; |
| 77 double GetBufferPoolUtilization() const override; | 77 double GetBufferPoolUtilization() const override; |
| 78 void SetCameraFacing(bool is_back_camera) override; |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 // Reserve output buffer into which I420 contents can be copied directly. | 81 // Reserve output buffer into which I420 contents can be copied directly. |
| 81 // The dimensions of the frame is described by |dimensions|, and requested | 82 // The dimensions of the frame is described by |dimensions|, and requested |
| 82 // output buffer format is specified by |storage|. The reserved output buffer | 83 // 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 | 84 // 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]. | 85 // plane is stored at [u_plane_data], V plane is stored at [v_plane_data]. |
| 85 // Returns an nullptr if allocation fails. | 86 // Returns an nullptr if allocation fails. |
| 86 // | 87 // |
| 87 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory | 88 // When requested |storage| is PIXEL_STORAGE_CPU, a single shared memory |
| (...skipping 18 matching lines...) Expand all Loading... |
| 106 | 107 |
| 107 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 108 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |
| 108 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; | 109 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; |
| 109 | 110 |
| 110 // Whether |external_jpeg_decoder_| has been initialized. | 111 // Whether |external_jpeg_decoder_| has been initialized. |
| 111 bool external_jpeg_decoder_initialized_; | 112 bool external_jpeg_decoder_initialized_; |
| 112 | 113 |
| 113 // The pool of shared-memory buffers used for capturing. | 114 // The pool of shared-memory buffers used for capturing. |
| 114 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 115 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| 115 | 116 |
| 117 // Whether the capture device is back camera. |
| 118 bool is_back_camera_; |
| 119 |
| 116 #if DCHECK_IS_ON() | 120 #if DCHECK_IS_ON() |
| 117 // Counter used to track the number of times consecutive capture buffers are | 121 // Counter used to track the number of times consecutive capture buffers are |
| 118 // dropped. | 122 // dropped. |
| 119 int dropped_frame_counter_ = 0; | 123 int dropped_frame_counter_ = 0; |
| 120 | 124 |
| 121 static const int kMaxDroppedFrames = 150; | 125 static const int kMaxDroppedFrames = 150; |
| 122 #endif // DCHECK_IS_ON() | 126 #endif // DCHECK_IS_ON() |
| 123 | 127 |
| 124 media::VideoPixelFormat last_captured_pixel_format_; | 128 media::VideoPixelFormat last_captured_pixel_format_; |
| 125 | 129 |
| 126 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace media | 133 } // namespace media |
| 130 | 134 |
| 131 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 135 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| OLD | NEW |