Chromium Code Reviews| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 // This object gets deleted on the UI thread after the IO thread has been | 178 // This object gets deleted on the UI thread after the IO thread has been |
| 179 // destroyed. So we need to know when IO thread is being destroyed so that | 179 // destroyed. So we need to know when IO thread is being destroyed so that |
| 180 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally | 180 // we can delete VideoCaptureManager and AudioInputDeviceManager. Normally |
| 181 // this is handled by | 181 // this is handled by |
| 182 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop. | 182 // base::MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop. |
| 183 // But for some tests which use TestBrowserThreadBundle, we need to call | 183 // But for some tests which use TestBrowserThreadBundle, we need to call |
| 184 // WillDestroyCurrentMessageLoop explicitly because the notification happens | 184 // WillDestroyCurrentMessageLoop explicitly because the notification happens |
| 185 // too late. (see http://crbug.com/247525#c14). | 185 // too late. (see http://crbug.com/247525#c14). |
| 186 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 186 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
| 187 | 187 |
| 188 // Adds |message| to native logs for outstanding device requests, for use by | |
| 189 // render processes requesting logging from webrtcLoggingPrivate API. | |
| 190 void AddLogMessageOnUIThread(const std::string& message); | |
| 191 static void SendMessageToNativeLog(const std::string& message); | |
|
perkj_chrome
2014/01/24 09:15:10
Can you add a comment that it is safe to call Send
no longer working on chromium
2014/01/24 09:54:38
will this static API be used outside MediaStreamMa
tommi (sloooow) - chröme
2014/01/24 12:34:54
+1 on documenting this function like the other met
vrk (LEFT CHROMIUM)
2014/01/25 00:50:21
Done.
vrk (LEFT CHROMIUM)
2014/01/25 00:50:21
Done.
vrk (LEFT CHROMIUM)
2014/01/25 00:50:21
Yes, it's already used in VideoCaptureController::
| |
| 192 | |
| 188 protected: | 193 protected: |
| 189 // Used for testing. | 194 // Used for testing. |
| 190 MediaStreamManager(); | 195 MediaStreamManager(); |
| 191 | 196 |
| 192 private: | 197 private: |
| 193 // Contains all data needed to keep track of requests. | 198 // Contains all data needed to keep track of requests. |
| 194 class DeviceRequest; | 199 class DeviceRequest; |
| 195 | 200 |
| 196 // Cache enumerated device list. | 201 // Cache enumerated device list. |
| 197 struct EnumerationCache { | 202 struct EnumerationCache { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 // Finds and returns the device id corresponding to the given | 318 // Finds and returns the device id corresponding to the given |
| 314 // |source_id|. Returns true if there was a raw device id that matched the | 319 // |source_id|. Returns true if there was a raw device id that matched the |
| 315 // given |source_id|, false if nothing matched it. | 320 // given |source_id|, false if nothing matched it. |
| 316 bool TranslateSourceIdToDeviceId( | 321 bool TranslateSourceIdToDeviceId( |
| 317 MediaStreamType stream_type, | 322 MediaStreamType stream_type, |
| 318 ResourceContext* rc, | 323 ResourceContext* rc, |
| 319 const GURL& security_origin, | 324 const GURL& security_origin, |
| 320 const std::string& source_id, | 325 const std::string& source_id, |
| 321 std::string* device_id) const; | 326 std::string* device_id) const; |
| 322 | 327 |
| 328 // Sends |stream_type| and the contents of |devices| to the | |
| 329 // webrtcLoggingPrivate API. | |
| 330 void LogDevicesToNativeLogs(MediaStreamType stream_type, | |
| 331 const StreamDeviceInfoArray& devices); | |
| 332 | |
| 323 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. | 333 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. |
| 324 scoped_ptr<base::Thread> device_thread_; | 334 scoped_ptr<base::Thread> device_thread_; |
| 325 | 335 |
| 326 media::AudioManager* const audio_manager_; // not owned | 336 media::AudioManager* const audio_manager_; // not owned |
| 327 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 337 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
| 328 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 338 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
| 329 | 339 |
| 330 // Indicator of device monitoring state. | 340 // Indicator of device monitoring state. |
| 331 bool monitoring_started_; | 341 bool monitoring_started_; |
| 332 | 342 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 348 | 358 |
| 349 bool use_fake_ui_; | 359 bool use_fake_ui_; |
| 350 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 360 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
| 351 | 361 |
| 352 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 362 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
| 353 }; | 363 }; |
| 354 | 364 |
| 355 } // namespace content | 365 } // namespace content |
| 356 | 366 |
| 357 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 367 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
| OLD | NEW |