summaryrefslogtreecommitdiffstats
path: root/content/browser/system_message_window_win.cc
diff options
context:
space:
mode:
authorxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 00:45:51 +0000
committerxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 00:45:51 +0000
commitc7bdd3190cf7f6328e459fd0befe6b658fdd49ee (patch)
tree992f3dc897fb0f3058eb2c43b78f43174f16e9f8 /content/browser/system_message_window_win.cc
parent27e5b39137ab196de4a6a069cec63cc21cf6c5b8 (diff)
downloadchromium_src-c7bdd3190cf7f6328e459fd0befe6b658fdd49ee.zip
chromium_src-c7bdd3190cf7f6328e459fd0befe6b658fdd49ee.tar.gz
chromium_src-c7bdd3190cf7f6328e459fd0befe6b658fdd49ee.tar.bz2
This patch will use the device listener in media to monitor audio capture device changed.
The reasons for doing this include: # when using the device notification from content/browser, the notification comes before the device is fully initialized, so the change won't show up in the following device enumeration. # I saw a serious crash by plugging in or unplugging an audio device, I believe it is because some racing between two notifications, if this is the case, this patch should fix it. BUG=160872,165147 TEST=manual test by plugging and unplugging device, look at the device selection menu in content setting media. Review URL: https://chromiumcodereview.appspot.com/11529012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/system_message_window_win.cc')
-rw-r--r--content/browser/system_message_window_win.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc
index d2a7808..08f44cb 100644
--- a/content/browser/system_message_window_win.cc
+++ b/content/browser/system_message_window_win.cc
@@ -5,12 +5,11 @@
#include "content/browser/system_message_window_win.h"
#include <dbt.h>
-#include <ks.h>
-#include <ksmedia.h>
#include "base/logging.h"
#include "base/system_monitor/system_monitor.h"
#include "base/win/wrapped_window_proc.h"
+#include "media/audio/win/core_audio_util_win.h"
namespace content {
@@ -45,7 +44,15 @@ class SystemMessageWindowWin::DeviceNotifications {
DEV_BROADCAST_DEVICEINTERFACE filter = {0};
filter.dbcc_size = sizeof(filter);
filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
+ bool core_audio_support = media::CoreAudioUtil::IsSupported();
for (int i = 0; i < arraysize(kDeviceCategoryMap); ++i) {
+ // If CoreAudio is supported, AudioDeviceListenerWin will
+ // take care of monitoring audio devices.
+ if (core_audio_support &&
+ KSCATEGORY_AUDIO == kDeviceCategoryMap[i].device_category) {
+ continue;
+ }
+
filter.dbcc_classguid = kDeviceCategoryMap[i].device_category;
DCHECK_EQ(notifications_[i], static_cast<HDEVNOTIFY>(NULL));
notifications_[i] = RegisterDeviceNotification(