| 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 // VideCaptureMessageFilter which lives inside the render process. | 6 // VideCaptureMessageFilter which lives inside the render process. |
| 7 // | 7 // |
| 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 virtual void OnBufferCreated(const VideoCaptureControllerID& id, | 71 virtual void OnBufferCreated(const VideoCaptureControllerID& id, |
| 72 base::SharedMemoryHandle handle, | 72 base::SharedMemoryHandle handle, |
| 73 int length, int buffer_id) OVERRIDE; | 73 int length, int buffer_id) OVERRIDE; |
| 74 virtual void OnBufferReady(const VideoCaptureControllerID& id, | 74 virtual void OnBufferReady(const VideoCaptureControllerID& id, |
| 75 int buffer_id, | 75 int buffer_id, |
| 76 base::Time timestamp) OVERRIDE; | 76 base::Time timestamp) OVERRIDE; |
| 77 virtual void OnFrameInfo(const VideoCaptureControllerID& id, | 77 virtual void OnFrameInfo(const VideoCaptureControllerID& id, |
| 78 int width, | 78 int width, |
| 79 int height, | 79 int height, |
| 80 int frame_per_second) OVERRIDE; | 80 int frame_per_second) OVERRIDE; |
| 81 virtual void OnPaused(const VideoCaptureControllerID& id) OVERRIDE; |
| 81 virtual void OnReadyToDelete(const VideoCaptureControllerID& id) OVERRIDE; | 82 virtual void OnReadyToDelete(const VideoCaptureControllerID& id) OVERRIDE; |
| 82 | 83 |
| 83 private: | 84 private: |
| 84 friend class content::BrowserThread; | 85 friend class content::BrowserThread; |
| 85 friend class base::DeleteHelper<VideoCaptureHost>; | 86 friend class base::DeleteHelper<VideoCaptureHost>; |
| 86 friend class MockVideoCaptureHost; | 87 friend class MockVideoCaptureHost; |
| 87 friend class VideoCaptureHostTest; | 88 friend class VideoCaptureHostTest; |
| 88 | 89 |
| 89 virtual ~VideoCaptureHost(); | 90 virtual ~VideoCaptureHost(); |
| 90 | 91 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 // IPC message: Pause capture on device referenced by |device_id|. | 108 // IPC message: Pause capture on device referenced by |device_id|. |
| 108 void OnPauseCapture(int device_id); | 109 void OnPauseCapture(int device_id); |
| 109 | 110 |
| 110 // IPC message: Receive an empty buffer from renderer. Send it to device | 111 // IPC message: Receive an empty buffer from renderer. Send it to device |
| 111 // referenced by |device_id|. | 112 // referenced by |device_id|. |
| 112 void OnReceiveEmptyBuffer(int device_id, int buffer_id); | 113 void OnReceiveEmptyBuffer(int device_id, int buffer_id); |
| 113 | 114 |
| 114 | 115 |
| 115 // Called on the IO thread when VideoCaptureController have | 116 // Called on the IO thread when VideoCaptureController have |
| 116 // reported that all DIBs have been returned. | 117 // reported that all DIBs have been returned. |
| 117 void DoDeleteVideoCaptureController(const VideoCaptureControllerID& id); | 118 void DoDeleteVideoCaptureControllerOnIOThread( |
| 119 const VideoCaptureControllerID& id); |
| 118 | 120 |
| 119 // Send a newly created buffer to the VideoCaptureMessageFilter. | 121 // Send a newly created buffer to the VideoCaptureMessageFilter. |
| 120 void DoSendNewBuffer(int device_id, | 122 void DoSendNewBufferOnIOThread(int device_id, |
| 121 base::SharedMemoryHandle handle, | 123 base::SharedMemoryHandle handle, |
| 122 int length, | 124 int length, |
| 123 int buffer_id); | 125 int buffer_id); |
| 124 | 126 |
| 125 // Send a filled buffer to the VideoCaptureMessageFilter. | 127 // Send a filled buffer to the VideoCaptureMessageFilter. |
| 126 void DoSendFilledBuffer(int device_id, | 128 void DoSendFilledBufferOnIOThread(int device_id, |
| 127 int buffer_id, | 129 int buffer_id, |
| 128 base::Time timestamp); | 130 base::Time timestamp); |
| 129 | 131 |
| 130 // Send a information about frame resolution and frame rate | 132 // Send a information about frame resolution and frame rate |
| 131 // to the VideoCaptureMessageFilter. | 133 // to the VideoCaptureMessageFilter. |
| 132 void DoSendFrameInfo(int device_id, | 134 void DoSendFrameInfoOnIOThread(int device_id, |
| 133 int width, | 135 int width, |
| 134 int height, | 136 int height, |
| 135 int frame_per_second); | 137 int frame_per_second); |
| 136 | 138 |
| 137 // Handle error coming from VideoCaptureDevice. | 139 // Handle error coming from VideoCaptureDevice. |
| 138 void DoHandleError(int device_id); | 140 void DoHandleErrorOnIOThread(int device_id); |
| 141 |
| 142 void DoPausedOnIOThread(int device_id); |
| 139 | 143 |
| 140 // Helpers. | 144 // Helpers. |
| 141 media_stream::VideoCaptureManager* GetVideoCaptureManager(); | 145 media_stream::VideoCaptureManager* GetVideoCaptureManager(); |
| 142 | 146 |
| 143 struct Entry; | 147 struct Entry; |
| 144 typedef std::map<VideoCaptureControllerID, Entry*> EntryMap; | 148 typedef std::map<VideoCaptureControllerID, Entry*> EntryMap; |
| 145 // A map of VideoCaptureControllerID to its state and VideoCaptureController. | 149 // A map of VideoCaptureControllerID to its state and VideoCaptureController. |
| 146 EntryMap entries_; | 150 EntryMap entries_; |
| 147 | 151 |
| 148 // Used to get a pointer to VideoCaptureManager to start/stop capture devices. | 152 // Used to get a pointer to VideoCaptureManager to start/stop capture devices. |
| 149 content::ResourceContext* resource_context_; | 153 content::ResourceContext* resource_context_; |
| 150 media::AudioManager* audio_manager_; | 154 media::AudioManager* audio_manager_; |
| 151 | 155 |
| 152 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); | 156 DISALLOW_COPY_AND_ASSIGN(VideoCaptureHost); |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ | 159 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_HOST_H_ |
| OLD | NEW |