| 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 // IPC message: Get supported formats referenced by |capture_session_id|. | 130 // IPC message: Get supported formats referenced by |capture_session_id|. |
| 126 // |device_id| is needed for message back-routing purposes. | 131 // |device_id| is needed for message back-routing purposes. |
| 127 void OnGetDeviceSupportedFormats( | 132 void OnGetDeviceSupportedFormats( |
| 128 int device_id, | 133 int device_id, |
| 129 media::VideoCaptureSessionId capture_session_id); | 134 media::VideoCaptureSessionId capture_session_id); |
| 130 | 135 |
| 131 // IPC message: Get a device's currently in use format(s), referenced by | 136 // IPC message: Get a device's currently in use format(s), referenced by |
| 132 // |capture_session_id|. |device_id| is needed for message back-routing | 137 // |capture_session_id|. |device_id| is needed for message back-routing |
| 133 // purposes. | 138 // purposes. |
| 134 void OnGetDeviceFormatsInUse( | 139 void OnGetDeviceFormatsInUse( |
| 135 int device_id, | 140 int device_id, |
| 136 media::VideoCaptureSessionId capture_session_id); | 141 media::VideoCaptureSessionId capture_session_id); |
| 137 | 142 |
| 138 // Send a newly created buffer to the VideoCaptureMessageFilter. | 143 // Send a newly created buffer to the VideoCaptureMessageFilter. |
| 139 void DoSendNewBufferOnIOThread( | 144 void DoSendNewBufferOnIOThread( |
| 140 const VideoCaptureControllerID& controller_id, | 145 const VideoCaptureControllerID& controller_id, |
| 141 base::SharedMemoryHandle handle, | 146 base::SharedMemoryHandle handle, |
| 142 int length, | 147 int length, |
| 143 int buffer_id); | 148 int buffer_id); |
| 144 | 149 |
| 145 void DoSendFreeBufferOnIOThread( | 150 void DoSendFreeBufferOnIOThread( |
| 146 const VideoCaptureControllerID& controller_id, | 151 const VideoCaptureControllerID& controller_id, |
| 147 int buffer_id); | 152 int buffer_id); |
| 148 | 153 |
| 149 // Send a filled buffer to the VideoCaptureMessageFilter. | 154 // Send a filled buffer to the VideoCaptureMessageFilter. |
| 150 void DoSendFilledBufferOnIOThread( | 155 void DoSendFilledBufferOnIOThread( |
| 151 const VideoCaptureControllerID& controller_id, | 156 const VideoCaptureControllerID& controller_id, |
| 152 int buffer_id, | 157 int buffer_id, |
| 153 base::TimeTicks timestamp, | 158 const media::VideoCaptureFormat& format, |
| 154 const media::VideoCaptureFormat& format); | 159 base::TimeTicks timestamp); |
| 160 |
| 161 // Send a filled texture mailbox buffer to the VideoCaptureMessageFilter. |
| 162 void DoSendFilledMailboxBufferOnIOThread( |
| 163 const VideoCaptureControllerID& controller_id, |
| 164 int buffer_id, |
| 165 const gpu::MailboxHolder& mailbox_holder, |
| 166 const media::VideoCaptureFormat& format, |
| 167 base::TimeTicks timestamp); |
| 155 | 168 |
| 156 // Handle error coming from VideoCaptureDevice. | 169 // Handle error coming from VideoCaptureDevice. |
| 157 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); | 170 void DoHandleErrorOnIOThread(const VideoCaptureControllerID& controller_id); |
| 158 | 171 |
| 159 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); | 172 void DoEndedOnIOThread(const VideoCaptureControllerID& controller_id); |
| 160 | 173 |
| 161 void DeleteVideoCaptureControllerOnIOThread( | 174 void DeleteVideoCaptureControllerOnIOThread( |
| 162 const VideoCaptureControllerID& controller_id); | 175 const VideoCaptureControllerID& controller_id); |
| 163 | 176 |
| 164 MediaStreamManager* media_stream_manager_; | 177 MediaStreamManager* media_stream_manager_; |
| 165 | 178 |
| 166 typedef std::map<VideoCaptureControllerID, | 179 typedef std::map<VideoCaptureControllerID, |
| 167 base::WeakPtr<VideoCaptureController> > EntryMap; | 180 base::WeakPtr<VideoCaptureController> > EntryMap; |
| 168 | 181 |
| 169 // A map of VideoCaptureControllerID to the VideoCaptureController to which it | 182 // A map of VideoCaptureControllerID to the VideoCaptureController to which it |
| 170 // is connected. An entry in this map holds a null controller while it is in | 183 // is connected. An entry in this map holds a null controller while it is in |
| 171 // the process of starting. | 184 // the process of starting. |
| 172 EntryMap entries_; | 185 EntryMap entries_; |
| 173 | 186 |
| 174 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 187 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
| 175 }; | 188 }; |
| 176 | 189 |
| 177 } // namespace content | 190 } // namespace content |
| 178 | 191 |
| 179 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 192 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
| OLD | NEW |