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 // VideoCaptureHost serves video capture related messages from | 5 // VideoCaptureHost serves video capture related messages from |
6 // VideoCaptureMessageFilter which lives inside the render process. | 6 // VideoCaptureMessageFilter which lives inside the render process. |
7 // | 7 // |
8 // This class is owned by RenderProcessHostImpl, and instantiated on UI | 8 // This class is owned by RenderProcessHostImpl, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread. | 9 // thread, but all other operations and method calls happen on IO thread. |
10 // | 10 // |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // VideoCaptureControllerEventHandler implementation. | 78 // VideoCaptureControllerEventHandler implementation. |
79 void OnError(const VideoCaptureControllerID& id) override; | 79 void OnError(const VideoCaptureControllerID& id) override; |
80 void OnBufferCreated(const VideoCaptureControllerID& id, | 80 void OnBufferCreated(const VideoCaptureControllerID& id, |
81 base::SharedMemoryHandle handle, | 81 base::SharedMemoryHandle handle, |
82 int length, | 82 int length, |
83 int buffer_id) override; | 83 int buffer_id) override; |
84 void OnBufferDestroyed(const VideoCaptureControllerID& id, | 84 void OnBufferDestroyed(const VideoCaptureControllerID& id, |
85 int buffer_id) override; | 85 int buffer_id) override; |
86 void OnBufferReady(const VideoCaptureControllerID& id, | 86 void OnBufferReady(const VideoCaptureControllerID& id, |
87 int buffer_id, | 87 int buffer_id, |
88 const media::VideoCaptureFormat& format, | 88 const gfx::Size& coded_size, |
89 const gfx::Rect& visible_rect, | 89 const gfx::Rect& visible_rect, |
90 base::TimeTicks timestamp) override; | 90 base::TimeTicks timestamp, |
91 void OnMailboxBufferReady(const VideoCaptureControllerID& id, | 91 scoped_ptr<base::DictionaryValue> metadata) override; |
92 int buffer_id, | 92 void OnMailboxBufferReady( |
93 const gpu::MailboxHolder& mailbox_holder, | 93 const VideoCaptureControllerID& id, |
94 const media::VideoCaptureFormat& format, | 94 int buffer_id, |
95 base::TimeTicks timestamp) override; | 95 const gpu::MailboxHolder& mailbox_holder, |
| 96 const gfx::Size& packed_frame_size, |
| 97 base::TimeTicks timestamp, |
| 98 scoped_ptr<base::DictionaryValue> metadata) override; |
96 void OnEnded(const VideoCaptureControllerID& id) override; | 99 void OnEnded(const VideoCaptureControllerID& id) override; |
97 | 100 |
98 private: | 101 private: |
99 friend class BrowserThread; | 102 friend class BrowserThread; |
100 friend class base::DeleteHelper<VideoCaptureHost>; | 103 friend class base::DeleteHelper<VideoCaptureHost>; |
101 friend class MockVideoCaptureHost; | 104 friend class MockVideoCaptureHost; |
102 friend class VideoCaptureHostTest; | 105 friend class VideoCaptureHostTest; |
103 | 106 |
104 ~VideoCaptureHost() override; | 107 ~VideoCaptureHost() override; |
105 | 108 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 int buffer_id); | 155 int buffer_id); |
153 | 156 |
154 void DoSendFreeBufferOnIOThread( | 157 void DoSendFreeBufferOnIOThread( |
155 const VideoCaptureControllerID& controller_id, | 158 const VideoCaptureControllerID& controller_id, |
156 int buffer_id); | 159 int buffer_id); |
157 | 160 |
158 // Sends a filled buffer to the VideoCaptureMessageFilter. | 161 // Sends a filled buffer to the VideoCaptureMessageFilter. |
159 void DoSendFilledBufferOnIOThread( | 162 void DoSendFilledBufferOnIOThread( |
160 const VideoCaptureControllerID& controller_id, | 163 const VideoCaptureControllerID& controller_id, |
161 int buffer_id, | 164 int buffer_id, |
162 const media::VideoCaptureFormat& format, | 165 const gfx::Size& coded_size, |
163 const gfx::Rect& visible_rect, | 166 const gfx::Rect& visible_rect, |
164 base::TimeTicks timestamp); | 167 base::TimeTicks timestamp, |
| 168 scoped_ptr<base::DictionaryValue> metadata); |
165 | 169 |
166 // Sends a filled texture mailbox buffer to the VideoCaptureMessageFilter. | 170 // Sends a filled texture mailbox buffer to the VideoCaptureMessageFilter. |
167 void DoSendFilledMailboxBufferOnIOThread( | 171 void DoSendFilledMailboxBufferOnIOThread( |
168 const VideoCaptureControllerID& controller_id, | 172 const VideoCaptureControllerID& controller_id, |
169 int buffer_id, | 173 int buffer_id, |
170 const gpu::MailboxHolder& mailbox_holder, | 174 const gpu::MailboxHolder& mailbox_holder, |
171 const media::VideoCaptureFormat& format, | 175 const gfx::Size& packed_frame_size, |
172 base::TimeTicks timestamp); | 176 base::TimeTicks timestamp, |
| 177 scoped_ptr<base::DictionaryValue> metadata); |
173 | 178 |
174 // Handles error coming from VideoCaptureDevice. | 179 // Handles error coming from VideoCaptureDevice. |
175 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); | 180 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); |
176 | 181 |
177 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); | 182 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); |
178 | 183 |
179 // Deletes the controller and notifies the VideoCaptureManager. |on_error| is | 184 // Deletes the controller and notifies the VideoCaptureManager. |on_error| is |
180 // true if this is triggered by VideoCaptureControllerEventHandler::OnError. | 185 // true if this is triggered by VideoCaptureControllerEventHandler::OnError. |
181 void DeleteVideoCaptureControllerOnIOThread( | 186 void DeleteVideoCaptureControllerOnIOThread( |
182 const VideoCaptureControllerID& controller_id, bool on_error); | 187 const VideoCaptureControllerID& controller_id, bool on_error); |
183 | 188 |
184 MediaStreamManager* media_stream_manager_; | 189 MediaStreamManager* media_stream_manager_; |
185 | 190 |
186 typedef std::map<VideoCaptureControllerID, | 191 typedef std::map<VideoCaptureControllerID, |
187 base::WeakPtr<VideoCaptureController> > EntryMap; | 192 base::WeakPtr<VideoCaptureController> > EntryMap; |
188 | 193 |
189 // A map of VideoCaptureControllerID to the VideoCaptureController to which it | 194 // A map of VideoCaptureControllerID to the VideoCaptureController to which it |
190 // is connected. An entry in this map holds a null controller while it is in | 195 // is connected. An entry in this map holds a null controller while it is in |
191 // the process of starting. | 196 // the process of starting. |
192 EntryMap entries_; | 197 EntryMap entries_; |
193 | 198 |
194 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 199 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
195 }; | 200 }; |
196 | 201 |
197 } // namespace content | 202 } // namespace content |
198 | 203 |
199 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 204 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |