Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: content/browser/renderer_host/media/video_capture_controller.h

Issue 2735083002: [Mojo Video Capture] Add test coverage for accelerated jpeg decoding (Closed)
Patch Set: Incorporated suggestions from Patch Set 3 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
181 template <typename Action>
182 void PerformForClientsWithOpenSessionT();
mcasas 2017/03/08 22:04:51 If we use Bind() to call PerformForClientsWithOpen
chfremer 2017/03/08 22:21:22 Oops. Thanks for catching this. Done.
183
175 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver> 184 std::unique_ptr<media::VideoFrameConsumerFeedbackObserver>
176 consumer_feedback_observer_; 185 consumer_feedback_observer_;
177 186
178 std::vector<BufferContext> buffer_contexts_; 187 std::vector<BufferContext> buffer_contexts_;
179 188
180 // All clients served by this controller. 189 // All clients served by this controller.
181 ControllerClients controller_clients_; 190 ControllerClients controller_clients_;
182 191
183 // Takes on only the states 'STARTED' and 'ERROR'. 'ERROR' is an absorbing 192 // Takes on only the states 'STARTED' and 'ERROR'. 'ERROR' is an absorbing
184 // state which stops the flow of data to clients. 193 // state which stops the flow of data to clients.
185 VideoCaptureState state_; 194 VideoCaptureState state_;
186 195
187 int next_buffer_context_id_ = 0; 196 int next_buffer_context_id_ = 0;
188 197
189 // True if the controller has received a video frame from the device. 198 // True if the controller has received a video frame from the device.
190 bool has_received_frames_; 199 bool has_received_frames_;
191 200
192 media::VideoCaptureFormat video_capture_format_; 201 media::VideoCaptureFormat video_capture_format_;
193 202
194 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_; 203 base::WeakPtrFactory<VideoCaptureController> weak_ptr_factory_;
195 204
196 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController); 205 DISALLOW_COPY_AND_ASSIGN(VideoCaptureController);
197 }; 206 };
198 207
199 } // namespace content 208 } // namespace content
200 209
201 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ 210 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698