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

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

Issue 1267883002: Pass GpuMemoryBuffer backed VideoFrame from browser to renderer processes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmbtracker-multiple
Patch Set: reveman@ comment: remove multiple textures. Created 5 years, 4 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_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 media::VideoCaptureSessionId session_id() const { return session_id_; } 78 media::VideoCaptureSessionId session_id() const { return session_id_; }
79 79
80 private: 80 private:
81 friend class VideoCaptureImplTest; 81 friend class VideoCaptureImplTest;
82 friend class MockVideoCaptureImpl; 82 friend class MockVideoCaptureImpl;
83 83
84 // Carries a shared memory for transferring video frames from browser to 84 // Carries a shared memory for transferring video frames from browser to
85 // renderer. 85 // renderer.
86 class ClientBuffer; 86 class ClientBuffer;
87 // Carries GpuMemoryBuffers for transferring video frames from browser to
88 // renderer.
89 class ClientVideoCaptureBuffer;
reveman 2015/08/26 11:54:05 ClientBuffer2? I think the existing comment is suf
emircan 2015/08/26 21:23:12 Done.
87 90
88 // VideoCaptureMessageFilter::Delegate interface. 91 // VideoCaptureMessageFilter::Delegate interface.
89 void OnBufferCreated(base::SharedMemoryHandle handle, 92 void OnBufferCreated(base::SharedMemoryHandle handle,
90 int length, 93 int length,
91 int buffer_id) override; 94 int buffer_id) override;
95 void OnBufferCreated2(
96 const std::vector<gfx::GpuMemoryBufferHandle>& gmb_handles,
reveman 2015/08/26 11:54:05 nit: s/gmb_handles/handles/
emircan 2015/08/26 21:23:12 Done.
97 const gfx::Size& size,
98 int buffer_id) override;
92 void OnBufferDestroyed(int buffer_id) override; 99 void OnBufferDestroyed(int buffer_id) override;
93 void OnBufferReceived(int buffer_id, 100 void OnBufferReceived(
94 base::TimeTicks timestamp, 101 int buffer_id,
95 const base::DictionaryValue& metadata, 102 base::TimeTicks timestamp,
96 media::VideoPixelFormat pixel_format, 103 const base::DictionaryValue& metadata,
97 media::VideoFrame::StorageType storage_type, 104 media::VideoPixelFormat pixel_format,
98 const gfx::Size& coded_size, 105 media::VideoFrame::StorageType storage_type,
99 const gfx::Rect& visible_rect, 106 const gfx::Size& coded_size,
100 const gpu::MailboxHolder& mailbox_holder) override; 107 const gfx::Rect& visible_rect,
108 const gpu::MailboxHolder& mailbox_holders) override;
reveman 2015/08/26 11:54:05 why "holders??
emircan 2015/08/26 21:23:12 Done.
101 void OnStateChanged(VideoCaptureState state) override; 109 void OnStateChanged(VideoCaptureState state) override;
102 void OnDeviceSupportedFormatsEnumerated( 110 void OnDeviceSupportedFormatsEnumerated(
103 const media::VideoCaptureFormats& supported_formats) override; 111 const media::VideoCaptureFormats& supported_formats) override;
104 void OnDeviceFormatsInUseReceived( 112 void OnDeviceFormatsInUseReceived(
105 const media::VideoCaptureFormats& formats_in_use) override; 113 const media::VideoCaptureFormats& formats_in_use) override;
106 void OnDelegateAdded(int32 device_id) override; 114 void OnDelegateAdded(int32 device_id) override;
107 115
108 // Sends an IPC message to browser process when all clients are done with the 116 // Sends an IPC message to browser process when all clients are done with the
109 // buffer. 117 // buffer.
110 void OnClientBufferFinished(int buffer_id, 118 void OnClientBufferFinished(
111 const scoped_refptr<ClientBuffer>& buffer, 119 int buffer_id,
112 uint32 release_sync_point, 120 const scoped_refptr<ClientBuffer>& buffer,
113 double consumer_resource_utilization); 121 uint32 release_sync_point,
122 double consumer_resource_utilization);
123 void OnClientBufferFinished2(
124 int buffer_id,
125 const scoped_refptr<ClientVideoCaptureBuffer>& buffer,
126 uint32 release_sync_point,
127 double consumer_resource_utilization);
114 128
115 void StopDevice(); 129 void StopDevice();
116 void RestartCapture(); 130 void RestartCapture();
117 void StartCaptureInternal(); 131 void StartCaptureInternal();
118 132
119 virtual void Send(IPC::Message* message); 133 virtual void Send(IPC::Message* message);
120 134
121 // Helpers. 135 // Helpers.
122 // Called (by an unknown thread) when all consumers are done with a VideoFrame 136 // Called (by an unknown thread) when all consumers are done with a VideoFrame
123 // and its ref-count has gone to zero. This helper function grabs the 137 // and its ref-count has gone to zero. This helper function grabs the
(...skipping 16 matching lines...) Expand all
140 const int session_id_; 154 const int session_id_;
141 155
142 // Vector of callbacks to be notified of device format enumerations, used only 156 // Vector of callbacks to be notified of device format enumerations, used only
143 // on IO Thread. 157 // on IO Thread.
144 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_; 158 std::vector<VideoCaptureDeviceFormatsCB> device_formats_cb_queue_;
145 // Vector of callbacks to be notified of a device's in use capture format(s), 159 // Vector of callbacks to be notified of a device's in use capture format(s),
146 // used only on IO Thread. 160 // used only on IO Thread.
147 std::vector<VideoCaptureDeviceFormatsCB> device_formats_in_use_cb_queue_; 161 std::vector<VideoCaptureDeviceFormatsCB> device_formats_in_use_cb_queue_;
148 162
149 // Buffers available for sending to the client. 163 // Buffers available for sending to the client.
150 typedef std::map<int32, scoped_refptr<ClientBuffer> > ClientBufferMap; 164 typedef std::map<int32, scoped_refptr<ClientBuffer>> ClientBufferMap;
151 ClientBufferMap client_buffers_; 165 ClientBufferMap client_buffers_;
166 typedef std::map<int32, scoped_refptr<ClientVideoCaptureBuffer>>
167 ClientVideoCaptureBufferMap;
168 ClientVideoCaptureBufferMap client_video_capture_buffers_;
152 169
153 // Track information for the video capture client, consisting of parameters 170 // Track information for the video capture client, consisting of parameters
154 // for capturing and callbacks to the client. 171 // for capturing and callbacks to the client.
155 media::VideoCaptureParams client_params_; 172 media::VideoCaptureParams client_params_;
156 VideoCaptureStateUpdateCB state_update_cb_; 173 VideoCaptureStateUpdateCB state_update_cb_;
157 VideoCaptureDeliverFrameCB deliver_frame_cb_; 174 VideoCaptureDeliverFrameCB deliver_frame_cb_;
158 175
159 // The device's first captured frame timestamp sent from browser process side. 176 // The device's first captured frame timestamp sent from browser process side.
160 base::TimeTicks first_frame_timestamp_; 177 base::TimeTicks first_frame_timestamp_;
161 178
162 // State of this VideoCaptureImpl. 179 // State of this VideoCaptureImpl.
163 VideoCaptureState state_; 180 VideoCaptureState state_;
164 181
165 // IO message loop reference for checking correct class operation. 182 // IO message loop reference for checking correct class operation.
166 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 183 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
167 184
168 // WeakPtrFactory pointing back to |this| object, for use with 185 // WeakPtrFactory pointing back to |this| object, for use with
169 // media::VideoFrames constructed in OnBufferReceived() from buffers cached 186 // media::VideoFrames constructed in OnBufferReceived() from buffers cached
170 // in |client_buffers_|. 187 // in |client_buffers_|.
171 // NOTE: Weak pointers must be invalidated before all other member variables. 188 // NOTE: Weak pointers must be invalidated before all other member variables.
172 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; 189 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_;
173 190
174 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); 191 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl);
175 }; 192 };
176 193
177 } // namespace content 194 } // namespace content
178 195
179 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 196 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698