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. |
| 369 void CheckKeyboardMicOnUIThread(); |
| 370 #endif |
| 371 |
366 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and | 372 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and |
367 // used for enumerating audio output devices. | 373 // used for enumerating audio output devices. |
368 // Note: Enumeration tasks may take seconds to complete so must never be run | 374 // 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. | 375 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. |
370 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 376 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
371 | 377 |
372 media::AudioManager* const audio_manager_; // not owned | 378 media::AudioManager* const audio_manager_; // not owned |
373 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 379 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
374 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 380 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
375 | 381 |
376 // Indicator of device monitoring state. | 382 // Indicator of device monitoring state. |
377 bool monitoring_started_; | 383 bool monitoring_started_; |
378 | 384 |
| 385 #if defined(OS_CHROMEOS) |
| 386 // Flag that's set when we have checked if the system has a keyboard mic. We |
| 387 // only need to check it once, and not when constructing since that will |
| 388 // affect startup time. |
| 389 // Must be accessed on the IO thread; |
| 390 bool has_checked_keyboard_mic_; |
| 391 #endif |
| 392 |
379 // Stores most recently enumerated device lists. The cache is cleared when | 393 // 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. | 394 // monitoring is stopped or there is no request for that type of device. |
381 EnumerationCache audio_enumeration_cache_; | 395 EnumerationCache audio_enumeration_cache_; |
382 EnumerationCache video_enumeration_cache_; | 396 EnumerationCache video_enumeration_cache_; |
383 | 397 |
384 // Keeps track of live enumeration commands sent to VideoCaptureManager or | 398 // Keeps track of live enumeration commands sent to VideoCaptureManager or |
385 // AudioInputDeviceManager, in order to only enumerate when necessary. | 399 // AudioInputDeviceManager, in order to only enumerate when necessary. |
386 int active_enumeration_ref_count_[NUM_MEDIA_TYPES]; | 400 int active_enumeration_ref_count_[NUM_MEDIA_TYPES]; |
387 | 401 |
388 // All non-closed request. Must be accessed on IO thread. | 402 // All non-closed request. Must be accessed on IO thread. |
389 DeviceRequests requests_; | 403 DeviceRequests requests_; |
390 | 404 |
391 // Hold a pointer to the IO loop to check we delete the device thread and | 405 // Hold a pointer to the IO loop to check we delete the device thread and |
392 // managers on the right thread. | 406 // managers on the right thread. |
393 base::MessageLoop* io_loop_; | 407 base::MessageLoop* io_loop_; |
394 | 408 |
395 bool use_fake_ui_; | 409 bool use_fake_ui_; |
396 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 410 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
397 | 411 |
398 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 412 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
399 }; | 413 }; |
400 | 414 |
401 } // namespace content | 415 } // namespace content |
402 | 416 |
403 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 417 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |