Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 1097553003: Switch to STA mode for audio thread and WASAPI I/O streams. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 380
381 MediaStreamManager::EnumerationCache::EnumerationCache() 381 MediaStreamManager::EnumerationCache::EnumerationCache()
382 : valid(false) { 382 : valid(false) {
383 } 383 }
384 384
385 MediaStreamManager::EnumerationCache::~EnumerationCache() { 385 MediaStreamManager::EnumerationCache::~EnumerationCache() {
386 } 386 }
387 387
388 MediaStreamManager::MediaStreamManager() 388 MediaStreamManager::MediaStreamManager()
389 : audio_manager_(NULL), 389 : audio_manager_(NULL),
390 #if defined(OS_WIN)
391 video_capture_thread_("VideoCaptureThread"),
392 #endif
393 monitoring_started_(false), 390 monitoring_started_(false),
394 #if defined(OS_CHROMEOS) 391 #if defined(OS_CHROMEOS)
395 has_checked_keyboard_mic_(false), 392 has_checked_keyboard_mic_(false),
396 #endif 393 #endif
397 io_loop_(NULL), 394 io_loop_(NULL),
398 use_fake_ui_(false) {} 395 use_fake_ui_(false) {}
399 396
400 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager) 397 MediaStreamManager::MediaStreamManager(media::AudioManager* audio_manager)
401 : audio_manager_(audio_manager), 398 : audio_manager_(audio_manager),
402 #if defined(OS_WIN)
403 video_capture_thread_("VideoCaptureThread"),
404 #endif
405 monitoring_started_(false), 399 monitoring_started_(false),
406 #if defined(OS_CHROMEOS) 400 #if defined(OS_CHROMEOS)
407 has_checked_keyboard_mic_(false), 401 has_checked_keyboard_mic_(false),
408 #endif 402 #endif
409 io_loop_(NULL), 403 io_loop_(NULL),
410 use_fake_ui_(false) { 404 use_fake_ui_(false) {
411 DCHECK(audio_manager_); 405 DCHECK(audio_manager_);
412 memset(active_enumeration_ref_count_, 0, 406 memset(active_enumeration_ref_count_, 0,
413 sizeof(active_enumeration_ref_count_)); 407 sizeof(active_enumeration_ref_count_));
414 408
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 } 1652 }
1659 1653
1660 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is 1654 // TODO(dalecurtis): Remove ScopedTracker below once crbug.com/457525 is
1661 // fixed. 1655 // fixed.
1662 tracked_objects::ScopedTracker tracking_profile4( 1656 tracked_objects::ScopedTracker tracking_profile4(
1663 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1657 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1664 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4")); 1658 "457525 MediaStreamManager::InitializeDeviceManagersOnIOThread 4"));
1665 video_capture_manager_ = 1659 video_capture_manager_ =
1666 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory( 1660 new VideoCaptureManager(media::VideoCaptureDeviceFactory::CreateFactory(
1667 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); 1661 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)));
1668 #if defined(OS_WIN)
1669 // Use an STA Video Capture Thread to try to avoid crashes on enumeration of
1670 // buggy third party Direct Show modules, http://crbug.com/428958.
mcasas 2015/04/17 17:15:56 I would like to keep this indication of "buggy thi
DaleCurtis 2015/04/17 17:58:32 Where would you prefer this text goes? I've added
mcasas 2015/04/17 20:23:31 Perhaps add them next to l.1676 of this side of th
DaleCurtis 2015/04/18 01:40:19 Didn't make sense here, so I put it up where devic
DaleCurtis 2015/04/18 02:36:48 Actually, I misread that, it looks like there's a
1671 video_capture_thread_.init_com_with_mta(false);
1672 CHECK(video_capture_thread_.Start());
1673 video_capture_manager_->Register(this,
1674 video_capture_thread_.message_loop_proxy());
1675 #else
1676 video_capture_manager_->Register(this, device_task_runner_); 1662 video_capture_manager_->Register(this, device_task_runner_);
1677 #endif
1678 } 1663 }
1679 1664
1680 void MediaStreamManager::Opened(MediaStreamType stream_type, 1665 void MediaStreamManager::Opened(MediaStreamType stream_type,
1681 int capture_session_id) { 1666 int capture_session_id) {
1682 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1667 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1683 DVLOG(1) << "Opened({stream_type = " << stream_type << "} " 1668 DVLOG(1) << "Opened({stream_type = " << stream_type << "} "
1684 << "{capture_session_id = " << capture_session_id << "})"; 1669 << "{capture_session_id = " << capture_session_id << "})";
1685 // Find the request(s) containing this device and mark it as used. 1670 // Find the request(s) containing this device and mark it as used.
1686 // It can be used in several requests since the same device can be 1671 // It can be used in several requests since the same device can be
1687 // requested from the same web page. 1672 // requested from the same web page.
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 } 2182 }
2198 } 2183 }
2199 2184
2200 void MediaStreamManager::SetKeyboardMicOnDeviceThread() { 2185 void MediaStreamManager::SetKeyboardMicOnDeviceThread() {
2201 DCHECK(device_task_runner_->BelongsToCurrentThread()); 2186 DCHECK(device_task_runner_->BelongsToCurrentThread());
2202 audio_manager_->SetHasKeyboardMic(); 2187 audio_manager_->SetHasKeyboardMic();
2203 } 2188 }
2204 #endif 2189 #endif
2205 2190
2206 } // namespace content 2191 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698