| Index: media/audio/win/audio_manager_win.cc
|
| diff --git a/media/audio/win/audio_manager_win.cc b/media/audio/win/audio_manager_win.cc
|
| index c09fb46284d6d8f4d1126816bf87d3dc6a9bee2e..9742fc9d66b780fd30a6e6e34a7218665250f2ef 100644
|
| --- a/media/audio/win/audio_manager_win.cc
|
| +++ b/media/audio/win/audio_manager_win.cc
|
| @@ -129,23 +129,21 @@ static int NumberOfWaveOutBuffers() {
|
| }
|
|
|
| AudioManagerWin::AudioManagerWin(AudioLogFactory* audio_log_factory)
|
| - : AudioManagerBase(audio_log_factory),
|
| - // |CoreAudioUtil::IsSupported()| uses static variables to avoid doing
|
| - // multiple initializations. This is however not thread safe.
|
| - // So, here we call it explicitly before we kick off the audio thread
|
| - // or do any other work.
|
| - enumeration_type_(CoreAudioUtil::IsSupported() ?
|
| - kMMDeviceEnumeration : kWaveEnumeration) {
|
| + : AudioManagerBase(audio_log_factory), enumeration_type_(kNoEnumeration) {
|
| SetMaxOutputStreamsAllowed(kMaxOutputStreams);
|
|
|
| // WARNING: This is executed on the UI loop, do not add any code here which
|
| // loads libraries or attempts to call out into the OS. Instead add such code
|
| // to the InitializeOnAudioThread() method below.
|
| + //
|
| + // WARNING: Do not make any calls to CoreAudioUtil within the constructor, it
|
| + // will attempt to perform COM initialization.
|
|
|
| // Task must be posted last to avoid races from handing out "this" to the
|
| // audio thread.
|
| - GetTaskRunner()->PostTask(FROM_HERE, base::Bind(
|
| - &AudioManagerWin::InitializeOnAudioThread, base::Unretained(this)));
|
| + GetTaskRunner()->PostTask(
|
| + FROM_HERE, base::Bind(&AudioManagerWin::InitializeOnAudioThread,
|
| + base::Unretained(this)));
|
| }
|
|
|
| AudioManagerWin::~AudioManagerWin() {
|
| @@ -166,6 +164,8 @@ bool AudioManagerWin::HasAudioInputDevices() {
|
|
|
| void AudioManagerWin::InitializeOnAudioThread() {
|
| DCHECK(GetTaskRunner()->BelongsToCurrentThread());
|
| + enumeration_type_ =
|
| + CoreAudioUtil::IsSupported() ? kMMDeviceEnumeration : kWaveEnumeration;
|
|
|
| if (core_audio_supported()) {
|
| // AudioDeviceListenerWin must be initialized on a COM thread and should
|
| @@ -517,7 +517,7 @@ AudioInputStream* AudioManagerWin::CreatePCMWaveInAudioInputStream(
|
| const std::string& device_id) {
|
| std::string xp_device_id = device_id;
|
| if (device_id != AudioManagerBase::kDefaultDeviceId &&
|
| - enumeration_type_ == kMMDeviceEnumeration) {
|
| + enumeration_type() == kMMDeviceEnumeration) {
|
| xp_device_id = ConvertToWinXPInputDeviceId(device_id);
|
| if (xp_device_id.empty()) {
|
| DLOG(ERROR) << "Cannot find a waveIn device which matches the device ID "
|
|
|