Chromium Code Reviews| Index: media/audio/win/core_audio_util_win.cc |
| diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc |
| index 51623955be189afc67c19644185c692b80edd06d..82d5402ff3475149e4f8be65a8fec38b969ce3e5 100644 |
| --- a/media/audio/win/core_audio_util_win.cc |
| +++ b/media/audio/win/core_audio_util_win.cc |
| @@ -230,10 +230,23 @@ ScopedComPtr<IMMDeviceEnumerator> CoreAudioUtil::CreateDeviceEnumerator() { |
| ScopedComPtr<IMMDeviceEnumerator> device_enumerator; |
| HRESULT hr = device_enumerator.CreateInstance(__uuidof(MMDeviceEnumerator), |
| NULL, CLSCTX_INPROC_SERVER); |
| + if (hr == CO_E_NOTINITIALIZED) { |
| + LOG(ERROR) << "CoCreateInstance fails with CO_E_NOTINITIALIZED"; |
| + // We have seen crashes which indicates that this method can in fact |
| + // fail with CO_E_NOTINITIALIZED in combination with certain 3rd party |
| + // modules. Calling CoInitializeEx is an attempt to resolve the reported |
| + // issues. See http://crbug.com/378465 for details. |
| + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); |
| + if (SUCCEEDED(hr)) { |
| + hr = device_enumerator.CreateInstance(__uuidof(MMDeviceEnumerator), |
| + NULL, CLSCTX_INPROC_SERVER); |
| + } |
| + } |
| CHECK(SUCCEEDED(hr)); |
| return device_enumerator; |
| } |
| + |
|
tommi (sloooow) - chröme
2014/06/12 10:56:20
one line should be enough :)
henrika (OOO until Aug 14)
2014/06/12 11:01:19
Ooops, sorry.
|
| ScopedComPtr<IMMDevice> CoreAudioUtil::CreateDefaultDevice(EDataFlow data_flow, |
| ERole role) { |
| DCHECK(IsSupported()); |