summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authordalecurtis <dalecurtis@chromium.org>2015-04-28 01:03:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-28 08:03:10 +0000
commit84c468567142e212b6c07ffc12458d9e5a797192 (patch)
treedad032a3de78f1a8341bd274d6a902572fe3f276 /media
parentf70f6e425f806b9a612e6f1fe10f466ba8fd2015 (diff)
downloadchromium_src-84c468567142e212b6c07ffc12458d9e5a797192.zip
chromium_src-84c468567142e212b6c07ffc12458d9e5a797192.tar.gz
chromium_src-84c468567142e212b6c07ffc12458d9e5a797192.tar.bz2
Don't allow CoreAudioUtil::IsSupported() to reinitialize COM.
I introduced this change in http://crrev.com/324246 but I now think it's incorrect based on the fact that the UI thread should already have COM initialized. BUG=422522 TEST=audio plays Review URL: https://codereview.chromium.org/1103383003 Cr-Commit-Position: refs/heads/master@{#327244}
Diffstat (limited to 'media')
-rw-r--r--media/audio/win/core_audio_util_win.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc
index 53530df..bf1c56b 100644
--- a/media/audio/win/core_audio_util_win.cc
+++ b/media/audio/win/core_audio_util_win.cc
@@ -168,11 +168,12 @@ static HRESULT GetDeviceFriendlyNameInternal(IMMDevice* device,
return hr;
}
-static ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumeratorInternal() {
+static ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumeratorInternal(
+ bool allow_reinitialize) {
ScopedComPtr<IMMDeviceEnumerator> device_enumerator;
HRESULT hr = device_enumerator.CreateInstance(__uuidof(MMDeviceEnumerator),
NULL, CLSCTX_INPROC_SERVER);
- if (hr == CO_E_NOTINITIALIZED) {
+ if (hr == CO_E_NOTINITIALIZED && allow_reinitialize) {
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
@@ -215,7 +216,7 @@ static bool IsSupportedInternal() {
// that it is possible to a create the IMMDeviceEnumerator interface. If this
// works as well we should be home free.
ScopedComPtr<IMMDeviceEnumerator> device_enumerator =
- CreateDeviceEnumeratorInternal();
+ CreateDeviceEnumeratorInternal(false);
if (!device_enumerator) {
LOG(ERROR)
<< "Failed to create Core Audio device enumerator on thread with ID "
@@ -274,7 +275,7 @@ int CoreAudioUtil::NumberOfActiveDevices(EDataFlow data_flow) {
ScopedComPtr<IMMDeviceEnumerator> CoreAudioUtil::CreateDeviceEnumerator() {
DCHECK(IsSupported());
ScopedComPtr<IMMDeviceEnumerator> device_enumerator =
- CreateDeviceEnumeratorInternal();
+ CreateDeviceEnumeratorInternal(true);
CHECK(device_enumerator);
return device_enumerator;
}