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 // MediaStreamManager is used to open/enumerate media capture devices (video | 5 // MediaStreamManager is used to open/enumerate media capture devices (video |
6 // supported now). Call flow: | 6 // supported now). Call flow: |
7 // 1. GenerateStream is called when a render process wants to use a capture | 7 // 1. GenerateStream is called when a render process wants to use a capture |
8 // device. | 8 // device. |
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to | 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to |
10 // use devices and for which device to use. | 10 // use devices and for which device to use. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const GURL& security_origin, | 159 const GURL& security_origin, |
160 const std::string& source_id, | 160 const std::string& source_id, |
161 std::string* device_id) const; | 161 std::string* device_id) const; |
162 | 162 |
163 // Called by UI to make sure the device monitor is started so that UI receive | 163 // Called by UI to make sure the device monitor is started so that UI receive |
164 // notifications about device changes. | 164 // notifications about device changes. |
165 void EnsureDeviceMonitorStarted(); | 165 void EnsureDeviceMonitorStarted(); |
166 | 166 |
167 // Implements MediaStreamProviderListener. | 167 // Implements MediaStreamProviderListener. |
168 virtual void Opened(MediaStreamType stream_type, | 168 virtual void Opened(MediaStreamType stream_type, |
169 int capture_session_id) OVERRIDE; | 169 int capture_session_id) override; |
170 virtual void Closed(MediaStreamType stream_type, | 170 virtual void Closed(MediaStreamType stream_type, |
171 int capture_session_id) OVERRIDE; | 171 int capture_session_id) override; |
172 virtual void DevicesEnumerated(MediaStreamType stream_type, | 172 virtual void DevicesEnumerated(MediaStreamType stream_type, |
173 const StreamDeviceInfoArray& devices) OVERRIDE; | 173 const StreamDeviceInfoArray& devices) override; |
174 virtual void Aborted(MediaStreamType stream_type, | 174 virtual void Aborted(MediaStreamType stream_type, |
175 int capture_session_id) OVERRIDE; | 175 int capture_session_id) override; |
176 | 176 |
177 // Implements base::SystemMonitor::DevicesChangedObserver. | 177 // Implements base::SystemMonitor::DevicesChangedObserver. |
178 virtual void OnDevicesChanged( | 178 virtual void OnDevicesChanged( |
179 base::SystemMonitor::DeviceType device_type) OVERRIDE; | 179 base::SystemMonitor::DeviceType device_type) override; |
180 | 180 |
181 // Called by the tests to specify a fake UI that should be used for next | 181 // Called by the tests to specify a fake UI that should be used for next |
182 // generated stream (or when using --use-fake-ui-for-media-stream). | 182 // generated stream (or when using --use-fake-ui-for-media-stream). |
183 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); | 183 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); |
184 | 184 |
185 // Returns all devices currently opened by a request with label |label|. | 185 // Returns all devices currently opened by a request with label |label|. |
186 // If no request with |label| exist, an empty array is returned. | 186 // If no request with |label| exist, an empty array is returned. |
187 StreamDeviceInfoArray GetDevicesOpenedByRequest( | 187 StreamDeviceInfoArray GetDevicesOpenedByRequest( |
188 const std::string& label) const; | 188 const std::string& label) const; |
189 | 189 |
190 // This object gets deleted on the UI thread after the IO thread has been | 190 // This object gets deleted on the UI thread after the IO thread has been |
191 // destroyed. So we need to know when IO thread is being destroyed so that | 191 // destroyed. So we need to know when IO thread is being destroyed so that |
192 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally | 192 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally |
193 // this is handled by | 193 // this is handled by |
194 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop. | 194 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop. |
195 // But for some tests which use TestBrowserThreadBundle, we need to call | 195 // But for some tests which use TestBrowserThreadBundle, we need to call |
196 // WillDestroyCurrentMessageLoop explicitly because the notification happens | 196 // WillDestroyCurrentMessageLoop explicitly because the notification happens |
197 // too late. (see http://crbug.com/247525#c14). | 197 // too late. (see http://crbug.com/247525#c14). |
198 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 198 virtual void WillDestroyCurrentMessageLoop() override; |
199 | 199 |
200 // Sends log messages to the render process hosts whose corresponding render | 200 // Sends log messages to the render process hosts whose corresponding render |
201 // processes are making device requests, to be used by the | 201 // processes are making device requests, to be used by the |
202 // webrtcLoggingPrivate API if requested. | 202 // webrtcLoggingPrivate API if requested. |
203 void AddLogMessageOnIOThread(const std::string& message); | 203 void AddLogMessageOnIOThread(const std::string& message); |
204 | 204 |
205 // Adds |message| to native logs for outstanding device requests, for use by | 205 // Adds |message| to native logs for outstanding device requests, for use by |
206 // render processes hosts whose corresponding render processes are requesting | 206 // render processes hosts whose corresponding render processes are requesting |
207 // logging from webrtcLoggingPrivate API. Safe to call from any thread. | 207 // logging from webrtcLoggingPrivate API. Safe to call from any thread. |
208 static void SendMessageToNativeLog(const std::string& message); | 208 static void SendMessageToNativeLog(const std::string& message); |
209 | 209 |
210 // base::PowerObserver overrides. | 210 // base::PowerObserver overrides. |
211 virtual void OnSuspend() OVERRIDE; | 211 virtual void OnSuspend() override; |
212 virtual void OnResume() OVERRIDE; | 212 virtual void OnResume() override; |
213 | 213 |
214 protected: | 214 protected: |
215 // Used for testing. | 215 // Used for testing. |
216 MediaStreamManager(); | 216 MediaStreamManager(); |
217 | 217 |
218 private: | 218 private: |
219 // Contains all data needed to keep track of requests. | 219 // Contains all data needed to keep track of requests. |
220 class DeviceRequest; | 220 class DeviceRequest; |
221 | 221 |
222 // Cache enumerated device list. | 222 // Cache enumerated device list. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 bool use_fake_ui_; | 417 bool use_fake_ui_; |
418 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 418 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
419 | 419 |
420 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 420 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
421 }; | 421 }; |
422 | 422 |
423 } // namespace content | 423 } // namespace content |
424 | 424 |
425 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 425 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |