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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // VideoCaptureControllerEventHandler implementation. | 79 // VideoCaptureControllerEventHandler implementation. |
80 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE; | 80 virtual void OnError(const VideoCaptureControllerID& id) OVERRIDE; |
81 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 81 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
82 base::SharedMemoryHandle handle, | 82 base::SharedMemoryHandle handle, |
83 int length, | 83 int length, |
84 int buffer_id) OVERRIDE; | 84 int buffer_id) OVERRIDE; |
85 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, | 85 virtual void OnBufferDestroyed(const VideoCaptureControllerID& id, |
86 int buffer_id) OVERRIDE; | 86 int buffer_id) OVERRIDE; |
87 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 87 virtual void OnBufferReady(const VideoCaptureControllerID& id, |
88 int buffer_id, | 88 int buffer_id, |
89 base::TimeTicks timestamp, | 89 const media::VideoCaptureFormat& format, |
90 const media::VideoCaptureFormat& format) OVERRIDE; | 90 base::TimeTicks timestamp) OVERRIDE; |
| 91 virtual void OnMailboxBufferReady(const VideoCaptureControllerID& id, |
| 92 int buffer_id, |
| 93 const gpu::MailboxHolder& mailbox_holder, |
| 94 const media::VideoCaptureFormat& format, |
| 95 base::TimeTicks timestamp) OVERRIDE; |
91 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE; | 96 virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE; |
92 | 97 |
93 private: | 98 private: |
94 friend class BrowserThread; | 99 friend class BrowserThread; |
95 friend class base::DeleteHelper<VideoCaptureHost>; | 100 friend class base::DeleteHelper<VideoCaptureHost>; |
96 friend class MockVideoCaptureHost; | 101 friend class MockVideoCaptureHost; |
97 friend class VideoCaptureHostTest; | 102 friend class VideoCaptureHostTest; |
98 | 103 |
99 virtual ~VideoCaptureHost(); | 104 virtual ~VideoCaptureHost(); |
100 | 105 |
(...skipping 12 matching lines...) Expand all Loading... |
113 const base::WeakPtr<VideoCaptureController>& controller); | 118 const base::WeakPtr<VideoCaptureController>& controller); |
114 | 119 |
115 // IPC message: Stop capture on device referenced by |device_id|. | 120 // IPC message: Stop capture on device referenced by |device_id|. |
116 void OnStopCapture(int device_id); | 121 void OnStopCapture(int device_id); |
117 | 122 |
118 // IPC message: Pause capture on device referenced by |device_id|. | 123 // IPC message: Pause capture on device referenced by |device_id|. |
119 void OnPauseCapture(int device_id); | 124 void OnPauseCapture(int device_id); |
120 | 125 |
121 // IPC message: Receive an empty buffer from renderer. Send it to device | 126 // IPC message: Receive an empty buffer from renderer. Send it to device |
122 // referenced by |device_id|. | 127 // referenced by |device_id|. |
123 void OnReceiveEmptyBuffer(int device_id, int buffer_id); | 128 void OnReceiveEmptyBuffer(int device_id, int buffer_id, uint32 sync_point); |
124 | 129 |
125 // Send a newly created buffer to the VideoCaptureMessageFilter. | 130 // Send a newly created buffer to the VideoCaptureMessageFilter. |
126 void DoSendNewBufferOnIOThread( | 131 void DoSendNewBufferOnIOThread( |
127 const VideoCaptureControllerID& controller_id, | 132 const VideoCaptureControllerID& controller_id, |
128 base::SharedMemoryHandle handle, | 133 base::SharedMemoryHandle handle, |
129 int length, | 134 int length, |
130 int buffer_id); | 135 int buffer_id); |
131 | 136 |
132 void DoSendFreeBufferOnIOThread( | 137 void DoSendFreeBufferOnIOThread( |
133 const VideoCaptureControllerID& controller_id, | 138 const VideoCaptureControllerID& controller_id, |
134 int buffer_id); | 139 int buffer_id); |
135 | 140 |
136 // Send a filled buffer to the VideoCaptureMessageFilter. | 141 // Send a filled buffer to the VideoCaptureMessageFilter. |
137 void DoSendFilledBufferOnIOThread( | 142 void DoSendFilledBufferOnIOThread( |
138 const VideoCaptureControllerID& controller_id, | 143 const VideoCaptureControllerID& controller_id, |
139 int buffer_id, | 144 int buffer_id, |
140 base::TimeTicks timestamp, | 145 const media::VideoCaptureFormat& format, |
141 const media::VideoCaptureFormat& format); | 146 base::TimeTicks timestamp); |
| 147 |
| 148 // Send a filled texture mailbox buffer to the VideoCaptureMessageFilter. |
| 149 void DoSendFilledMailboxBufferOnIOThread( |
| 150 const VideoCaptureControllerID& controller_id, |
| 151 int buffer_id, |
| 152 const gpu::MailboxHolder& mailbox_holder, |
| 153 const media::VideoCaptureFormat& format, |
| 154 base::TimeTicks timestamp); |
142 | 155 |
143 // Handle error coming from VideoCaptureDevice. | 156 // Handle error coming from VideoCaptureDevice. |
144 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); | 157 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); |
145 | 158 |
146 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); | 159 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); |
147 | 160 |
148 void DeleteVideoCaptureControllerOnIOThread( | 161 void DeleteVideoCaptureControllerOnIOThread( |
149 const VideoCaptureControllerID& controller_id); | 162 const VideoCaptureControllerID& controller_id); |
150 | 163 |
151 MediaStreamManager* media_stream_manager_; | 164 MediaStreamManager* media_stream_manager_; |
152 | 165 |
153 typedef std::map<VideoCaptureControllerID, | 166 typedef std::map<VideoCaptureControllerID, |
154 base::WeakPtr<VideoCaptureController> > EntryMap; | 167 base::WeakPtr<VideoCaptureController> > EntryMap; |
155 | 168 |
156 // A map of VideoCaptureControllerID to the VideoCaptureController to which it | 169 // A map of VideoCaptureControllerID to the VideoCaptureController to which it |
157 // is connected. An entry in this map holds a null controller while it is in | 170 // is connected. An entry in this map holds a null controller while it is in |
158 // the process of starting. | 171 // the process of starting. |
159 EntryMap entries_; | 172 EntryMap entries_; |
160 | 173 |
161 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 174 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
162 }; | 175 }; |
163 | 176 |
164 } // namespace content | 177 } // namespace content |
165 | 178 |
166 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 179 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
OLD | NEW |