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