| 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; | |
| 106 | 105 |
| 107 private: | 106 private: |
| 108 struct ControllerClient; | 107 struct ControllerClient; |
| 109 typedef std::list<std::unique_ptr<ControllerClient>> ControllerClients; | 108 typedef std::list<std::unique_ptr<ControllerClient>> ControllerClients; |
| 110 | 109 |
| 111 class BufferContext { | 110 class BufferContext { |
| 112 public: | 111 public: |
| 113 BufferContext( | 112 BufferContext( |
| 114 int buffer_context_id, | 113 int buffer_context_id, |
| 115 int buffer_id, | 114 int buffer_id, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int buffer_context_id); | 165 int buffer_context_id); |
| 167 std::vector<BufferContext>::iterator FindUnretiredBufferContextFromBufferId( | 166 std::vector<BufferContext>::iterator FindUnretiredBufferContextFromBufferId( |
| 168 int buffer_id); | 167 int buffer_id); |
| 169 | 168 |
| 170 void OnClientFinishedConsumingBuffer(ControllerClient* client, | 169 void OnClientFinishedConsumingBuffer(ControllerClient* client, |
| 171 int buffer_id, | 170 int buffer_id, |
| 172 double consumer_resource_utilization); | 171 double consumer_resource_utilization); |
| 173 void ReleaseBufferContext( | 172 void ReleaseBufferContext( |
| 174 const std::vector<BufferContext>::iterator& buffer_state_iter); | 173 const std::vector<BufferContext>::iterator& buffer_state_iter); |
| 175 | 174 |
| 176 using EventHandlerAction = | |
| 177 base::Callback<void(VideoCaptureControllerEventHandler* client, | |
| 178 VideoCaptureControllerID id)>; | |
| 179 void PerformForClientsWithOpenSession(EventHandlerAction action); | |
| 180 | |
| 181 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver> | 175 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver> |
| 182 consumer_feedback_observer_; | 176 consumer_feedback_observer_; |
| 183 | 177 |
| 184 std::vector<BufferContext> buffer_contexts_; | 178 std::vector<BufferContext> buffer_contexts_; |
| 185 | 179 |
| 186 // All clients served by this controller. | 180 // All clients served by this controller. |
| 187 ControllerClients controller_clients_; | 181 ControllerClients controller_clients_; |
| 188 | 182 |
| 189 // Takes on only the states 'STARTING', 'STARTED' and 'ERROR'. 'ERROR' is an | 183 // Takes on only the states 'STARTING', 'STARTED' and 'ERROR'. 'ERROR' is an |
| 190 // absorbing state which stops the flow of data to clients. | 184 // absorbing state which stops the flow of data to clients. |
| 191 VideoCaptureState state_; | 185 VideoCaptureState state_; |
| 192 | 186 |
| 193 int next_buffer_context_id_ = 0; | 187 int next_buffer_context_id_ = 0; |
| 194 | 188 |
| 195 // True if the controller has received a video frame from the device. | 189 // True if the controller has received a video frame from the device. |
| 196 bool has_received_frames_; | 190 bool has_received_frames_; |
| 197 | 191 |
| 198 media::VideoCaptureFormat video_capture_format_; | 192 media::VideoCaptureFormat video_capture_format_; |
| 199 | 193 |
| 200 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; | 194 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; |
| 201 | 195 |
| 202 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); | 196 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); |
| 203 }; | 197 }; |
| 204 | 198 |
| 205 } // namespace content | 199 } // namespace content |
| 206 | 200 |
| 207 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 201 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
| OLD | NEW |