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

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

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // for capturing and callbacks to the client. 97 // for capturing and callbacks to the client.
98 struct ClientInfo { 98 struct ClientInfo {
99 ClientInfo(); 99 ClientInfo();
100 ~ClientInfo(); 100 ~ClientInfo();
101 media::VideoCaptureParams params; 101 media::VideoCaptureParams params;
102 VideoCaptureStateUpdateCB state_update_cb; 102 VideoCaptureStateUpdateCB state_update_cb;
103 VideoCaptureDeliverFrameCB deliver_frame_cb; 103 VideoCaptureDeliverFrameCB deliver_frame_cb;
104 }; 104 };
105 typedef std::map<int, ClientInfo> ClientInfoMap; 105 typedef std::map<int, ClientInfo> ClientInfoMap;
106 106
107 typedef base::Callback<void(const gpu::SyncToken& sync_token,
108 double consumer_resource_utilization)>
109 BufferFinishedCallback;
110
107 // VideoCaptureMessageFilter::Delegate interface. 111 // VideoCaptureMessageFilter::Delegate interface.
108 void OnBufferCreated(base::SharedMemoryHandle handle, 112 void OnBufferCreated(base::SharedMemoryHandle handle,
109 int length, 113 int length,
110 int buffer_id) override; 114 int buffer_id) override;
111 void OnBufferCreated2(const std::vector<gfx::GpuMemoryBufferHandle>& handles, 115 void OnBufferCreated2(const std::vector<gfx::GpuMemoryBufferHandle>& handles,
112 const gfx::Size& size, 116 const gfx::Size& size,
113 int buffer_id) override; 117 int buffer_id) override;
114 void OnBufferDestroyed(int buffer_id) override; 118 void OnBufferDestroyed(int buffer_id) override;
115 void OnBufferReceived( 119 void OnBufferReceived(
116 int buffer_id, 120 int buffer_id,
117 base::TimeTicks timestamp, 121 base::TimeTicks timestamp,
118 const base::DictionaryValue& metadata, 122 const base::DictionaryValue& metadata,
119 media::VideoPixelFormat pixel_format, 123 media::VideoPixelFormat pixel_format,
120 media::VideoFrame::StorageType storage_type, 124 media::VideoFrame::StorageType storage_type,
121 const gfx::Size& coded_size, 125 const gfx::Size& coded_size,
122 const gfx::Rect& visible_rect, 126 const gfx::Rect& visible_rect,
123 const gpu::MailboxHolder& mailbox_holder) override; 127 const gpu::MailboxHolder& mailbox_holder) override;
124 void OnStateChanged(VideoCaptureState state) override; 128 void OnStateChanged(VideoCaptureState state) override;
125 void OnDeviceSupportedFormatsEnumerated( 129 void OnDeviceSupportedFormatsEnumerated(
126 const media::VideoCaptureFormats& supported_formats) override; 130 const media::VideoCaptureFormats& supported_formats) override;
127 void OnDeviceFormatsInUseReceived( 131 void OnDeviceFormatsInUseReceived(
128 const media::VideoCaptureFormats& formats_in_use) override; 132 const media::VideoCaptureFormats& formats_in_use) override;
129 void OnDelegateAdded(int32 device_id) override; 133 void OnDelegateAdded(int32 device_id) override;
130 134
131 // Sends an IPC message to browser process when all clients are done with the 135 // Sends an IPC message to browser process when all clients are done with the
132 // buffer. 136 // buffer.
133 void OnClientBufferFinished( 137 void OnClientBufferFinished(int buffer_id,
134 int buffer_id, 138 const scoped_refptr<ClientBuffer>& buffer,
135 const scoped_refptr<ClientBuffer>& buffer, 139 const gpu::SyncToken& release_sync_token,
136 uint32 release_sync_point, 140 double consumer_resource_utilization);
137 double consumer_resource_utilization); 141 void OnClientBufferFinished2(int buffer_id,
138 void OnClientBufferFinished2( 142 const scoped_refptr<ClientBuffer2>& buffer,
139 int buffer_id, 143 const gpu::SyncToken& release_sync_token,
140 const scoped_refptr<ClientBuffer2>& buffer, 144 double consumer_resource_utilization);
141 uint32 release_sync_point,
142 double consumer_resource_utilization);
143 145
144 void StopDevice(); 146 void StopDevice();
145 void RestartCapture(); 147 void RestartCapture();
146 void StartCaptureInternal(); 148 void StartCaptureInternal();
147 149
148 virtual void Send(IPC::Message* message); 150 virtual void Send(IPC::Message* message);
149 151
150 // Helpers. 152 // Helpers.
151 bool RemoveClient(int client_id, ClientInfoMap* clients); 153 bool RemoveClient(int client_id, ClientInfoMap* clients);
152 154
153 // Called (by an unknown thread) when all consumers are done with a VideoFrame 155 // Called (by an unknown thread) when all consumers are done with a VideoFrame
154 // and its ref-count has gone to zero. This helper function grabs the 156 // and its ref-count has gone to zero. This helper function grabs the
155 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given 157 // RESOURCE_UTILIZATION value from the |metadata| and then runs the given
156 // callback, to trampoline back to the IO thread with the values. 158 // callback, to trampoline back to the IO thread with the values.
157 static void DidFinishConsumingFrame( 159 static void DidFinishConsumingFrame(
158 const media::VideoFrameMetadata* metadata, 160 const media::VideoFrameMetadata* metadata,
159 uint32* release_sync_point_storage, // Takes ownership. 161 gpu::SyncToken* release_sync_token_storage, // Takes ownership
160 const base::Callback<void(uint32, double)>& callback_to_io_thread); 162 const BufferFinishedCallback& callback_to_io_thread);
161 163
162 const scoped_refptr<VideoCaptureMessageFilter> message_filter_; 164 const scoped_refptr<VideoCaptureMessageFilter> message_filter_;
163 int device_id_; 165 int device_id_;
164 const int session_id_; 166 const int session_id_;
165 167
166 // Vector of callbacks to be notified of device format enumerations, used only 168 // Vector of callbacks to be notified of device format enumerations, used only
167 // on IO Thread. 169 // on IO Thread.
168 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_; 170 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_;
169 // Vector of callbacks to be notified of a device's in use capture format(s), 171 // Vector of callbacks to be notified of a device's in use capture format(s),
170 // used only on IO Thread. 172 // used only on IO Thread.
(...skipping 27 matching lines...) Expand all
198 // in |client_buffers_|. 200 // in |client_buffers_|.
199 // NOTE: Weak pointers must be invalidated before all other member variables. 201 // NOTE: Weak pointers must be invalidated before all other member variables.
200 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; 202 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_;
201 203
202 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); 204 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl);
203 }; 205 };
204 206
205 } // namespace content 207 } // namespace content
206 208
207 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 209 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | content/renderer/media/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698