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 #include "content/browser/renderer_host/media/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 MediaStreamManager::EnumerationCache::EnumerationCache() | 354 MediaStreamManager::EnumerationCache::EnumerationCache() |
355 : valid(false) { | 355 : valid(false) { |
356 } | 356 } |
357 | 357 |
358 MediaStreamManager::EnumerationCache::~EnumerationCache() { | 358 MediaStreamManager::EnumerationCache::~EnumerationCache() { |
359 } | 359 } |
360 | 360 |
361 MediaStreamManager::MediaStreamManager() | 361 MediaStreamManager::MediaStreamManager() |
362 : audio_manager_(NULL), | 362 : audio_manager_(NULL), |
363 #if defined(OS_WIN) | |
364 video_capture_thread_("VideoCaptureThread"), | |
365 #endif | |
366 monitoring_started_(false), | 363 monitoring_started_(false), |
367 #if defined(OS_CHROMEOS) | 364 #if defined(OS_CHROMEOS) |
368 has_checked_keyboard_mic_(false), | 365 has_checked_keyboard_mic_(false), |
369 #endif | 366 #endif |
370 io_loop_(NULL), | 367 io_loop_(NULL), |
371 use_fake_ui_(false) {} | 368 use_fake_ui_(false) {} |
372 | 369 |
373 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager) | 370 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager) |
374 : audio_manager_(audio_manager), | 371 : audio_manager_(audio_manager), |
375 #if defined(OS_WIN) | |
376 video_capture_thread_("VideoCaptureThread"), | |
377 #endif | |
378 monitoring_started_(false), | 372 monitoring_started_(false), |
379 #if defined(OS_CHROMEOS) | 373 #if defined(OS_CHROMEOS) |
380 has_checked_keyboard_mic_(false), | 374 has_checked_keyboard_mic_(false), |
381 #endif | 375 #endif |
382 io_loop_(NULL), | 376 io_loop_(NULL), |
383 use_fake_ui_(false) { | 377 use_fake_ui_(false) { |
384 DCHECK(audio_manager_); | 378 DCHECK(audio_manager_); |
385 memset(active_enumeration_ref_count_, 0, | 379 memset(active_enumeration_ref_count_, 0, |
386 sizeof(active_enumeration_ref_count_)); | 380 sizeof(active_enumeration_ref_count_)); |
387 | 381 |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 io_loop_->AddDestructionObserver(this); | 1588 io_loop_->AddDestructionObserver(this); |
1595 | 1589 |
1596 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1590 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1597 switches::kUseFakeDeviceForMediaStream)) { | 1591 switches::kUseFakeDeviceForMediaStream)) { |
1598 audio_input_device_manager()->UseFakeDevice(); | 1592 audio_input_device_manager()->UseFakeDevice(); |
1599 } | 1593 } |
1600 | 1594 |
1601 video_capture_manager_ = | 1595 video_capture_manager_ = |
1602 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory( | 1596 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory( |
1603 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); | 1597 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); |
1604 #if defined(OS_WIN) | |
1605 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of | |
1606 // buggy third party Direct Show modules, http://crbug.com/428958. | |
1607 video_capture_thread_.init_com_with_mta(false); | |
1608 CHECK(video_capture_thread_.Start()); | |
1609 video_capture_manager_->Register(this, | |
1610 video_capture_thread_.message_loop_proxy()); | |
1611 #else | |
1612 video_capture_manager_->Register(this, device_task_runner_); | 1598 video_capture_manager_->Register(this, device_task_runner_); |
1613 #endif | |
1614 } | 1599 } |
1615 | 1600 |
1616 void MediaStreamManager::Opened(MediaStreamType stream_type, | 1601 void MediaStreamManager::Opened(MediaStreamType stream_type, |
1617 int capture_session_id) { | 1602 int capture_session_id) { |
1618 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1603 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1619 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " | 1604 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " |
1620 << "{capture_session_id = " << capture_session_id << "})"; | 1605 << "{capture_session_id = " << capture_session_id << "})"; |
1621 // Find the request(s) containing this device and mark it as used. | 1606 // Find the request(s) containing this device and mark it as used. |
1622 // It can be used in several requests since the same device can be | 1607 // It can be used in several requests since the same device can be |
1623 // requested from the same web page. | 1608 // requested from the same web page. |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 } | 2116 } |
2132 } | 2117 } |
2133 | 2118 |
2134 void MediaStreamManager::SetKeyboardMicOnDeviceThread() { | 2119 void MediaStreamManager::SetKeyboardMicOnDeviceThread() { |
2135 DCHECK(device_task_runner_->BelongsToCurrentThread()); | 2120 DCHECK(device_task_runner_->BelongsToCurrentThread()); |
2136 audio_manager_->SetHasKeyboardMic(); | 2121 audio_manager_->SetHasKeyboardMic(); |
2137 } | 2122 } |
2138 #endif | 2123 #endif |
2139 | 2124 |
2140 } // namespace content | 2125 } // namespace content |
OLD | NEW |