diff options
author | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-11 01:59:37 +0000 |
---|---|---|
committer | dalecurtis@google.com <dalecurtis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-11 01:59:37 +0000 |
commit | ca8ceaa180917272404e2de7752a2052bd2dbfbf (patch) | |
tree | 3e4b8c1f025125b5875a8228296fabfdc3f2a1bd /media/audio/mac/audio_manager_mac.h | |
parent | 9bb9f99499ea9e60b3269c9e6053b5a3af1d51eb (diff) | |
download | chromium_src-ca8ceaa180917272404e2de7752a2052bd2dbfbf.zip chromium_src-ca8ceaa180917272404e2de7752a2052bd2dbfbf.tar.gz chromium_src-ca8ceaa180917272404e2de7752a2052bd2dbfbf.tar.bz2 |
Revert 176228
> Improve thread safety for device changes on OSX.
>
> Device changes are hard, lets go shopping! Sadly OSX does not handle property
> listener callbacks in a thread safe manner. On 10.6 we can set
> kAudioHardwarePropertyRunLoop to account for this. On 10.7 this is broken
> and we need to create a dispatch queue to drive callbacks. However code
> running on the dispatch queue must be mutually exclusive with code running
> on the audio thread.
>
> ExclusiveDispatchQueueTaskObserver works around this by pausing and resuming
> the dispatch queue before and after each pumped task. Benchmarks on my retina
> 10.8.2 macbook pro show on average this takes < 30us in total. No performance
> issues were seen even using FakeAudioOutputStream which drives audio callbacks
> on the message loop.
>
> Complicating matters it the fact that the AudioProperty(Add|Remove)ListenerBlock
> functions are not available on 10.6... so we need to dynamically load them :-/
>
> This is not ideal and long term we should replace the audio thread on OSX with a
> dispatch queue to avoid having to suspend/resume the queue; this is non-trivial
> and requires a significant refactoring of the AudioManager to support.
>
> BUG=158170
> TEST=media_unittests. manual device changes.
>
> Review URL: https://codereview.chromium.org/11824018
Fails on 10.6 :(
TBR=dalecurtis@google.com
Review URL: https://codereview.chromium.org/11840005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac/audio_manager_mac.h')
-rw-r--r-- | media/audio/mac/audio_manager_mac.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/media/audio/mac/audio_manager_mac.h b/media/audio/mac/audio_manager_mac.h index 40ed54e..d8b6b2d 100644 --- a/media/audio/mac/audio_manager_mac.h +++ b/media/audio/mac/audio_manager_mac.h @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "base/message_loop_proxy.h" #include "media/audio/audio_manager_base.h" -#include "media/audio/mac/audio_device_listener_mac.h" namespace media { @@ -38,15 +37,16 @@ class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( const AudioParameters& input_params) OVERRIDE; + // Called by an internal device change listener. Must be called on + // |creating_message_loop_|. + void OnDeviceChange(); + protected: virtual ~AudioManagerMac(); private: - // Helper methods for constructing AudioDeviceListenerMac on the audio thread. - void CreateDeviceListener(); - void DestroyDeviceListener(); - - scoped_ptr<AudioDeviceListenerMac> output_device_listener_; + bool listener_registered_; + scoped_refptr<base::MessageLoopProxy> creating_message_loop_; DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); }; |