OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int buffer_id, | 95 int buffer_id, |
96 int frame_feedback_id, | 96 int frame_feedback_id, |
97 std::unique_ptr< | 97 std::unique_ptr< |
98 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> | 98 media::VideoCaptureDevice::Client::Buffer::ScopedAccessPermission> |
99 buffer_read_permission, | 99 buffer_read_permission, |
100 media::mojom::VideoFrameInfoPtr frame_info) override; | 100 media::mojom::VideoFrameInfoPtr frame_info) override; |
101 void OnBufferRetired(int buffer_id) override; | 101 void OnBufferRetired(int buffer_id) override; |
102 void OnError() override; | 102 void OnError() override; |
103 void OnLog(const std::string& message) override; | 103 void OnLog(const std::string& message) override; |
104 void OnStarted() override; | 104 void OnStarted() override; |
| 105 void OnStartedUsingGpuDecode() override; |
105 | 106 |
106 private: | 107 private: |
107 struct ControllerClient; | 108 struct ControllerClient; |
108 typedef std::list<std::unique_ptr<ControllerClient>> ControllerClients; | 109 typedef std::list<std::unique_ptr<ControllerClient>> ControllerClients; |
109 | 110 |
110 class BufferContext { | 111 class BufferContext { |
111 public: | 112 public: |
112 BufferContext( | 113 BufferContext( |
113 int buffer_context_id, | 114 int buffer_context_id, |
114 int buffer_id, | 115 int buffer_id, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int buffer_context_id); | 166 int buffer_context_id); |
166 std::vector<BufferContext>::iterator FindUnretiredBufferContextFromBufferId( | 167 std::vector<BufferContext>::iterator FindUnretiredBufferContextFromBufferId( |
167 int buffer_id); | 168 int buffer_id); |
168 | 169 |
169 void OnClientFinishedConsumingBuffer(ControllerClient* client, | 170 void OnClientFinishedConsumingBuffer(ControllerClient* client, |
170 int buffer_id, | 171 int buffer_id, |
171 double consumer_resource_utilization); | 172 double consumer_resource_utilization); |
172 void ReleaseBufferContext( | 173 void ReleaseBufferContext( |
173 const std::vector<BufferContext>::iterator& buffer_state_iter); | 174 const std::vector<BufferContext>::iterator& buffer_state_iter); |
174 | 175 |
| 176 using EventHandlerAction = |
| 177 base::Callback<void(VideoCaptureControllerEventHandler* client, |
| 178 VideoCaptureControllerID id)>; |
| 179 void PerformForClientsWithOpenSession(EventHandlerAction action); |
| 180 |
175 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver> | 181 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver> |
176 consumer_feedback_observer_; | 182 consumer_feedback_observer_; |
177 | 183 |
178 std::vector<BufferContext> buffer_contexts_; | 184 std::vector<BufferContext> buffer_contexts_; |
179 | 185 |
180 // All clients served by this controller. | 186 // All clients served by this controller. |
181 ControllerClients controller_clients_; | 187 ControllerClients controller_clients_; |
182 | 188 |
183 // Takes on only the states 'STARTING', 'STARTED' and 'ERROR'. 'ERROR' is an | 189 // Takes on only the states 'STARTING', 'STARTED' and 'ERROR'. 'ERROR' is an |
184 // absorbing state which stops the flow of data to clients. | 190 // absorbing state which stops the flow of data to clients. |
185 VideoCaptureState state_; | 191 VideoCaptureState state_; |
186 | 192 |
187 int next_buffer_context_id_ = 0; | 193 int next_buffer_context_id_ = 0; |
188 | 194 |
189 // True if the controller has received a video frame from the device. | 195 // True if the controller has received a video frame from the device. |
190 bool has_received_frames_; | 196 bool has_received_frames_; |
191 | 197 |
192 media::VideoCaptureFormat video_capture_format_; | 198 media::VideoCaptureFormat video_capture_format_; |
193 | 199 |
194 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 200 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
195 | 201 |
196 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 202 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
197 }; | 203 }; |
198 | 204 |
199 } // namespace content | 205 } // namespace content |
200 | 206 |
201 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 207 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |