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

Side by Side Diff: content/renderer/media/video_capture_impl.h

Issue 2442193002: Removing gpu::SyncToken usage from video capture pipeline, part 1.
Patch Set: Removing gpu::SyncToken usage from video capture pipeline, part 1. Created 4 years, 1 month 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_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ClientInfo(); 107 ClientInfo();
108 ClientInfo(const ClientInfo& other); 108 ClientInfo(const ClientInfo& other);
109 ~ClientInfo(); 109 ~ClientInfo();
110 media::VideoCaptureParams params; 110 media::VideoCaptureParams params;
111 VideoCaptureStateUpdateCB state_update_cb; 111 VideoCaptureStateUpdateCB state_update_cb;
112 VideoCaptureDeliverFrameCB deliver_frame_cb; 112 VideoCaptureDeliverFrameCB deliver_frame_cb;
113 }; 113 };
114 using ClientInfoMap = std::map<int, ClientInfo>; 114 using ClientInfoMap = std::map<int, ClientInfo>;
115 115
116 using BufferFinishedCallback = 116 using BufferFinishedCallback =
117 base::Callback<void(const gpu::SyncToken& sync_token, 117 base::Callback<void(double consumer_resource_utilization)>;
118 double consumer_resource_utilization)>;
119 118
120 // VideoCaptureMessageFilter::Delegate interface implementation. 119 // VideoCaptureMessageFilter::Delegate interface implementation.
121 void OnBufferCreated(base::SharedMemoryHandle handle, 120 void OnBufferCreated(base::SharedMemoryHandle handle,
122 int length, 121 int length,
123 int buffer_id) override; 122 int buffer_id) override;
124 void OnBufferDestroyed(int buffer_id) override; 123 void OnBufferDestroyed(int buffer_id) override;
125 void OnBufferReceived(int buffer_id, 124 void OnBufferReceived(int buffer_id,
126 base::TimeDelta timestamp, 125 base::TimeDelta timestamp,
127 const base::DictionaryValue& metadata, 126 const base::DictionaryValue& metadata,
128 media::VideoPixelFormat pixel_format, 127 media::VideoPixelFormat pixel_format,
129 media::VideoFrame::StorageType storage_type, 128 media::VideoFrame::StorageType storage_type,
130 const gfx::Size& coded_size, 129 const gfx::Size& coded_size,
131 const gfx::Rect& visible_rect) override; 130 const gfx::Rect& visible_rect) override;
132 void OnDelegateAdded(int32_t device_id) override; 131 void OnDelegateAdded(int32_t device_id) override;
133 132
134 // mojom::VideoCaptureObserver implementation. 133 // mojom::VideoCaptureObserver implementation.
135 void OnStateChanged(mojom::VideoCaptureState state) override; 134 void OnStateChanged(mojom::VideoCaptureState state) override;
136 135
137 // Sends an IPC message to browser process when all clients are done with the 136 // Sends an IPC message to browser process when all clients are done with the
138 // buffer. 137 // buffer.
139 void OnClientBufferFinished(int buffer_id, 138 void OnClientBufferFinished(int buffer_id,
140 const scoped_refptr<ClientBuffer>& buffer, 139 const scoped_refptr<ClientBuffer>& buffer,
141 const gpu::SyncToken& release_sync_token,
142 double consumer_resource_utilization); 140 double consumer_resource_utilization);
143 141
144 void StopDevice(); 142 void StopDevice();
145 void RestartCapture(); 143 void RestartCapture();
146 void StartCaptureInternal(); 144 void StartCaptureInternal();
147 145
148 void OnDeviceSupportedFormats( 146 void OnDeviceSupportedFormats(
149 const VideoCaptureDeviceFormatsCB& callback, 147 const VideoCaptureDeviceFormatsCB& callback,
150 const media::VideoCaptureFormats& supported_formats); 148 const media::VideoCaptureFormats& supported_formats);
151 void OnDeviceFormatsInUse( 149 void OnDeviceFormatsInUse(
152 const VideoCaptureDeviceFormatsCB& callback, 150 const VideoCaptureDeviceFormatsCB& callback,
153 const media::VideoCaptureFormats& formats_in_use); 151 const media::VideoCaptureFormats& formats_in_use);
154 152
155 // Tries to remove |client_id| from |clients|, returning false if not found. 153 // Tries to remove |client_id| from |clients|, returning false if not found.
156 bool RemoveClient(int client_id, ClientInfoMap* clients); 154 bool RemoveClient(int client_id, ClientInfoMap* clients);
157 155
158 mojom::VideoCaptureHost* GetVideoCaptureHost(); 156 mojom::VideoCaptureHost* GetVideoCaptureHost();
159 157
160 // Called (by an unknown thread) when all consumers are done with a VideoFrame 158 // Called (by an unknown thread) when all consumers are done with a VideoFrame
161 // and its ref-count has gone to zero. This helper function grabs the 159 // and its ref-count has gone to zero. This helper function grabs the
162 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given 160 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given
163 // callback, to trampoline back to the IO thread with the values. 161 // callback, to trampoline back to the IO thread with the values.
164 static void DidFinishConsumingFrame( 162 static void DidFinishConsumingFrame(
165 const media::VideoFrameMetadata* metadata, 163 const media::VideoFrameMetadata* metadata,
166 std::unique_ptr<gpu::SyncToken> release_sync_token,
167 const BufferFinishedCallback& callback_to_io_thread); 164 const BufferFinishedCallback& callback_to_io_thread);
168 165
169 const scoped_refptr<VideoCaptureMessageFilter> message_filter_; 166 const scoped_refptr<VideoCaptureMessageFilter> message_filter_;
170 int device_id_; 167 int device_id_;
171 const int session_id_; 168 const int session_id_;
172 169
173 mojom::VideoCaptureHostAssociatedPtr video_capture_host_; 170 mojom::VideoCaptureHostAssociatedPtr video_capture_host_;
174 mojom::VideoCaptureHost* video_capture_host_for_testing_; 171 mojom::VideoCaptureHost* video_capture_host_for_testing_;
175 172
176 mojo::Binding<mojom::VideoCaptureObserver> observer_binding_; 173 mojo::Binding<mojom::VideoCaptureObserver> observer_binding_;
(...skipping 24 matching lines...) Expand all
201 // in |client_buffers_|. 198 // in |client_buffers_|.
202 // NOTE: Weak pointers must be invalidated before all other member variables. 199 // NOTE: Weak pointers must be invalidated before all other member variables.
203 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; 200 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_;
204 201
205 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); 202 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl);
206 }; 203 };
207 204
208 } // namespace content 205 } // namespace content
209 206
210 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 207 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698