summaryrefslogtreecommitdiffstats
path: root/content/browser/device_monitor_mac.h
diff options
context:
space:
mode:
authormcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 15:02:56 +0000
committermcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-22 15:02:56 +0000
commit74c3445f9f933495683b27a986ede3e8e4858e03 (patch)
tree5fa42046324b54428d15e61539bb620e631819a1 /content/browser/device_monitor_mac.h
parent80b0c8c1adf1991387a038ec157f09b6c81caa45 (diff)
downloadchromium_src-74c3445f9f933495683b27a986ede3e8e4858e03.zip
chromium_src-74c3445f9f933495683b27a986ede3e8e4858e03.tar.gz
chromium_src-74c3445f9f933495683b27a986ede3e8e4858e03.tar.bz2
Mac AVFoundation: Enumerate devices in device/audio thread.
Bug http://crbug.com/359589 describes a Chrome hang where two threads are calling [AVCaptureDeviceGlue devices] at the same time to enumerate the devices. The first call comes from DeviceMonitorMac::StartMonitoring() on UI thread while the second call comes from the Audio Thread, a.k.a. Device Thread on +VideoCaptureDeviceAVFoundation::getDeviceNames:. DMM == DeviceMonitorMac The solution proposed here is to do as much as possible on Device thread : - when there is a device change via DMM::OnDeviceChanged(), enumerate on Device Thread, then consolidate the device list on UI thread. - First |suspend_observer_| registration happens on Device Thread. This suspend observer lives in device thread. - Observer removal happens dutifully on Device Thread destructor in -CrAVFoundationDeviceObserver::dealloc BUG=288562, 359589 Review URL: https://codereview.chromium.org/234563004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/device_monitor_mac.h')
-rw-r--r--content/browser/device_monitor_mac.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/content/browser/device_monitor_mac.h b/content/browser/device_monitor_mac.h
index 696b961..b3d3f9f 100644
--- a/content/browser/device_monitor_mac.h
+++ b/content/browser/device_monitor_mac.h
@@ -25,8 +25,10 @@ class DeviceMonitorMac {
// Registers the observers for the audio/video device removal, connection and
// suspension. The AVFoundation library is also loaded and initialised if the
- // OS supports it.
- void StartMonitoring();
+ // OS supports it. The |device_task_runner| argument represents the thread on
+ // which device enumeration will occur.
+ void StartMonitoring(
+ const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner);
// Method called by the internal DeviceMonitorMacImpl object
// |device_monitor_impl_| when a device of type |type| has been added to or
@@ -38,7 +40,7 @@ class DeviceMonitorMac {
scoped_ptr<DeviceMonitorMacImpl> device_monitor_impl_;
// |thread_checker_| is used to check that constructor and StartMonitoring()
- // are called in the correct thread, that also owns the object.
+ // are called in the correct thread, the UI thread, that also owns the object.
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(DeviceMonitorMac);