Chromium Code Reviews| 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 media::VideoPixelFormat format, | 78 media::VideoPixelFormat format, |
| 79 media::VideoPixelStorage storage, | 79 media::VideoPixelStorage storage, |
| 80 int new_frame_feedback_id) override; | 80 int new_frame_feedback_id) override; |
| 81 void OnError(const tracked_objects::Location& from_here, | 81 void OnError(const tracked_objects::Location& from_here, |
| 82 const std::string& reason) override; | 82 const std::string& reason) override; |
| 83 void OnLog(const std::string& message) override; | 83 void OnLog(const std::string& message) override; |
| 84 void OnStarted() override; | 84 void OnStarted() override; |
| 85 double GetBufferPoolUtilization() const override; | 85 double GetBufferPoolUtilization() const override; |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 void OnUsingExternalJpegDecoder(); | |
| 89 | |
| 88 void InitializeI420PlanePointers(const gfx::Size& dimensions, | 90 void InitializeI420PlanePointers(const gfx::Size& dimensions, |
| 89 uint8_t* const data, | 91 uint8_t* const data, |
| 90 uint8_t** y_plane_data, | 92 uint8_t** y_plane_data, |
| 91 uint8_t** u_plane_data, | 93 uint8_t** u_plane_data, |
| 92 uint8_t** v_plane_data); | 94 uint8_t** v_plane_data); |
| 93 | 95 |
| 94 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. | 96 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. |
| 95 void OnIncomingCapturedY16Data(const uint8_t* data, | 97 void OnIncomingCapturedY16Data(const uint8_t* data, |
| 96 int length, | 98 int length, |
| 97 const VideoCaptureFormat& frame_format, | 99 const VideoCaptureFormat& frame_format, |
| 98 base::TimeTicks reference_time, | 100 base::TimeTicks reference_time, |
| 99 base::TimeDelta timestamp, | 101 base::TimeDelta timestamp, |
| 100 int frame_feedback_id); | 102 int frame_feedback_id); |
| 101 | 103 |
| 102 // The receiver to which we post events. | 104 // The receiver to which we post events. |
| 103 const std::unique_ptr<VideoFrameReceiver> receiver_; | 105 const std::unique_ptr<VideoFrameReceiver> receiver_; |
| 104 std::vector<int> buffer_ids_known_by_receiver_; | 106 std::vector<int> buffer_ids_known_by_receiver_; |
| 105 | 107 |
| 106 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 108 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |
| 107 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; | 109 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; |
| 108 | 110 |
| 109 // Whether |external_jpeg_decoder_| has been initialized. | 111 // Whether |external_jpeg_decoder_| has been initialized. |
| 110 bool external_jpeg_decoder_initialized_; | 112 bool external_jpeg_decoder_initialized_; |
| 113 bool using_external_jpeg_decoder_; | |
|
mcasas
2017/03/08 01:33:17
What about removing OnUsingExternalJpegDecoder()
a
chfremer
2017/03/08 18:58:08
Done.
| |
| 111 | 114 |
| 112 // The pool of shared-memory buffers used for capturing. | 115 // The pool of shared-memory buffers used for capturing. |
| 113 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 116 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| 114 | 117 |
| 115 #if DCHECK_IS_ON() | 118 #if DCHECK_IS_ON() |
| 116 // Counter used to track the number of times consecutive capture buffers are | 119 // Counter used to track the number of times consecutive capture buffers are |
| 117 // dropped. | 120 // dropped. |
| 118 int dropped_frame_counter_ = 0; | 121 int dropped_frame_counter_ = 0; |
| 119 | 122 |
| 120 static const int kMaxDroppedFrames = 150; | 123 static const int kMaxDroppedFrames = 150; |
| 121 #endif // DCHECK_IS_ON() | 124 #endif // DCHECK_IS_ON() |
| 122 | 125 |
| 123 media::VideoPixelFormat last_captured_pixel_format_; | 126 media::VideoPixelFormat last_captured_pixel_format_; |
| 124 | 127 |
| 125 // Thread collision warner to ensure that producer-facing API is not called | 128 // Thread collision warner to ensure that producer-facing API is not called |
| 126 // concurrently. Producers are allowed to call from multiple threads, but not | 129 // concurrently. Producers are allowed to call from multiple threads, but not |
| 127 // concurrently. | 130 // concurrently. |
| 128 DFAKE_MUTEX(call_from_producer_); | 131 DFAKE_MUTEX(call_from_producer_); |
| 129 | 132 |
| 130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 133 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
| 131 }; | 134 }; |
| 132 | 135 |
| 133 } // namespace media | 136 } // namespace media |
| 134 | 137 |
| 135 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 138 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
| OLD | NEW |