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 void OnNotUsingExternalJpegDecoder(); | |
90 | |
88 void InitializeI420PlanePointers(const gfx::Size& dimensions, | 91 void InitializeI420PlanePointers(const gfx::Size& dimensions, |
89 uint8_t* const data, | 92 uint8_t* const data, |
90 uint8_t** y_plane_data, | 93 uint8_t** y_plane_data, |
91 uint8_t** u_plane_data, | 94 uint8_t** u_plane_data, |
92 uint8_t** v_plane_data); | 95 uint8_t** v_plane_data); |
93 | 96 |
94 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. | 97 // A branch of OnIncomingCapturedData for Y16 frame_format.pixel_format. |
95 void OnIncomingCapturedY16Data(const uint8_t* data, | 98 void OnIncomingCapturedY16Data(const uint8_t* data, |
96 int length, | 99 int length, |
97 const VideoCaptureFormat& frame_format, | 100 const VideoCaptureFormat& frame_format, |
98 base::TimeTicks reference_time, | 101 base::TimeTicks reference_time, |
99 base::TimeDelta timestamp, | 102 base::TimeDelta timestamp, |
100 int frame_feedback_id); | 103 int frame_feedback_id); |
101 | 104 |
102 // The receiver to which we post events. | 105 // The receiver to which we post events. |
103 const std::unique_ptr<VideoFrameReceiver> receiver_; | 106 const std::unique_ptr<VideoFrameReceiver> receiver_; |
104 std::vector<int> buffer_ids_known_by_receiver_; | 107 std::vector<int> buffer_ids_known_by_receiver_; |
105 | 108 |
106 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; | 109 const VideoCaptureJpegDecoderFactoryCB jpeg_decoder_factory_callback_; |
107 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; | 110 std::unique_ptr<VideoCaptureJpegDecoder> external_jpeg_decoder_; |
108 | 111 |
109 // Whether |external_jpeg_decoder_| has been initialized. | 112 // Whether |external_jpeg_decoder_| has been initialized. |
110 bool external_jpeg_decoder_initialized_; | 113 bool external_jpeg_decoder_initialized_; |
114 bool using_external_jpeg_decoder_; | |
mcasas
2017/03/07 19:39:38
Isn't this variable having the same lifetime chang
chfremer
2017/03/07 22:30:38
The |external_jpeg_decoder_| is created and initia
| |
111 | 115 |
112 // The pool of shared-memory buffers used for capturing. | 116 // The pool of shared-memory buffers used for capturing. |
113 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 117 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
114 | 118 |
115 #if DCHECK_IS_ON() | 119 #if DCHECK_IS_ON() |
116 // Counter used to track the number of times consecutive capture buffers are | 120 // Counter used to track the number of times consecutive capture buffers are |
117 // dropped. | 121 // dropped. |
118 int dropped_frame_counter_ = 0; | 122 int dropped_frame_counter_ = 0; |
119 | 123 |
120 static const int kMaxDroppedFrames = 150; | 124 static const int kMaxDroppedFrames = 150; |
121 #endif // DCHECK_IS_ON() | 125 #endif // DCHECK_IS_ON() |
122 | 126 |
123 media::VideoPixelFormat last_captured_pixel_format_; | 127 media::VideoPixelFormat last_captured_pixel_format_; |
124 | 128 |
125 // Thread collision warner to ensure that producer-facing API is not called | 129 // Thread collision warner to ensure that producer-facing API is not called |
126 // concurrently. Producers are allowed to call from multiple threads, but not | 130 // concurrently. Producers are allowed to call from multiple threads, but not |
127 // concurrently. | 131 // concurrently. |
128 DFAKE_MUTEX(call_from_producer_); | 132 DFAKE_MUTEX(call_from_producer_); |
129 | 133 |
130 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); | 134 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceClient); |
131 }; | 135 }; |
132 | 136 |
133 } // namespace media | 137 } // namespace media |
134 | 138 |
135 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ | 139 #endif // MEDIA_CAPTURE_VIDEO_VIDEO_CAPTURE_DEVICE_CLIENT_H_ |
OLD | NEW |