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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // the webrtcLoggingPrivate API if requested. | 356 // the webrtcLoggingPrivate API if requested. |
357 void AddLogMessageOnUIThread(const std::set<int>& render_process_ids, | 357 void AddLogMessageOnUIThread(const std::set<int>& render_process_ids, |
358 const std::string& message); | 358 const std::string& message); |
359 | 359 |
360 // Handles the callback from MediaStreamUIProxy to receive the UI window id, | 360 // Handles the callback from MediaStreamUIProxy to receive the UI window id, |
361 // used for excluding the notification window in desktop capturing. | 361 // used for excluding the notification window in desktop capturing. |
362 void OnMediaStreamUIWindowId(MediaStreamType video_type, | 362 void OnMediaStreamUIWindowId(MediaStreamType video_type, |
363 StreamDeviceInfoArray devices, | 363 StreamDeviceInfoArray devices, |
364 gfx::NativeViewId window_id); | 364 gfx::NativeViewId window_id); |
365 | 365 |
| 366 #if defined(OS_CHROMEOS) |
| 367 // Checks if the system has a keyboard mic, and if so, inform the audio |
| 368 // manager via SetKeyboardMicOnDeviceThread(). |
| 369 void CheckKeyboardMicOnUIThread(); |
| 370 |
| 371 // Tells the audio mananger that the system supports a keyboard mic. |
| 372 void SetKeyboardMicOnDeviceThread(); |
| 373 #endif |
| 374 |
366 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and | 375 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and |
367 // used for enumerating audio output devices. | 376 // used for enumerating audio output devices. |
368 // Note: Enumeration tasks may take seconds to complete so must never be run | 377 // Note: Enumeration tasks may take seconds to complete so must never be run |
369 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. | 378 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. |
370 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 379 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
371 | 380 |
372 media::AudioManager* const audio_manager_; // not owned | 381 media::AudioManager* const audio_manager_; // not owned |
373 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 382 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
374 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 383 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
375 | 384 |
376 // Indicator of device monitoring state. | 385 // Indicator of device monitoring state. |
377 bool monitoring_started_; | 386 bool monitoring_started_; |
378 | 387 |
| 388 #if defined(OS_CHROMEOS) |
| 389 // Flag that's set when we have checked if the system has a keyboard mic. We |
| 390 // only need to check it once, and not when constructing since that will |
| 391 // affect startup time. |
| 392 // Must be accessed on the IO thread; |
| 393 bool has_checked_keyboard_mic_; |
| 394 #endif |
| 395 |
379 // Stores most recently enumerated device lists. The cache is cleared when | 396 // Stores most recently enumerated device lists. The cache is cleared when |
380 // monitoring is stopped or there is no request for that type of device. | 397 // monitoring is stopped or there is no request for that type of device. |
381 EnumerationCache audio_enumeration_cache_; | 398 EnumerationCache audio_enumeration_cache_; |
382 EnumerationCache video_enumeration_cache_; | 399 EnumerationCache video_enumeration_cache_; |
383 | 400 |
384 // Keeps track of live enumeration commands sent to VideoCaptureManager or | 401 // Keeps track of live enumeration commands sent to VideoCaptureManager or |
385 // AudioInputDeviceManager, in order to only enumerate when necessary. | 402 // AudioInputDeviceManager, in order to only enumerate when necessary. |
386 int active_enumeration_ref_count_[NUM_MEDIA_TYPES]; | 403 int active_enumeration_ref_count_[NUM_MEDIA_TYPES]; |
387 | 404 |
388 // All non-closed request. Must be accessed on IO thread. | 405 // All non-closed request. Must be accessed on IO thread. |
389 DeviceRequests requests_; | 406 DeviceRequests requests_; |
390 | 407 |
391 // Hold a pointer to the IO loop to check we delete the device thread and | 408 // Hold a pointer to the IO loop to check we delete the device thread and |
392 // managers on the right thread. | 409 // managers on the right thread. |
393 base::MessageLoop* io_loop_; | 410 base::MessageLoop* io_loop_; |
394 | 411 |
395 bool use_fake_ui_; | 412 bool use_fake_ui_; |
396 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 413 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
397 | 414 |
398 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 415 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
399 }; | 416 }; |
400 | 417 |
401 } // namespace content | 418 } // namespace content |
402 | 419 |
403 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 420 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |