Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: media/audio/win/audio_manager_win.cc

Issue 8606006: Adds support for capture device enumeration on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebase and fix lint warnings Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/audio/win/device_enumeration_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_manager_win.cc
===================================================================
--- media/audio/win/audio_manager_win.cc (revision 111497)
+++ media/audio/win/audio_manager_win.cc (working copy)
@@ -24,6 +24,7 @@
#include "media/audio/win/audio_low_latency_input_win.h"
#include "media/audio/win/audio_low_latency_output_win.h"
#include "media/audio/win/audio_manager_win.h"
+#include "media/audio/win/device_enumeration_win.h"
#include "media/audio/win/wavein_input_win.h"
#include "media/audio/win/waveout_output_win.h"
#include "media/base/limits.h"
@@ -99,6 +100,13 @@
AudioManagerWin::AudioManagerWin()
: num_output_streams_(0) {
+ if (base::win::GetVersion() <= base::win::VERSION_XP) {
+ // Use the Wave API for device enumeration if XP or lower.
+ enumeration_type_ = kWaveEnumeration;
+ } else {
+ // Use the MMDevice API for device enumeration if Vista or higher.
+ enumeration_type_ = kMMDeviceEnumeration;
+ }
}
AudioManagerWin::~AudioManagerWin() {
@@ -280,19 +288,26 @@
void AudioManagerWin::GetAudioInputDeviceNames(
media::AudioDeviceNames* device_names) {
- // TODO(xians): query a full list of valid devices.
- if (HasAudioInputDevices()) {
- // Add the default device to the list.
- // We use index 0 to make up the unique_id to identify the
- // default devices.
+ DCHECK(enumeration_type() != kUninitializedEnumeration);
+ // Enumerate all active audio-endpoint capture devices.
+ if (enumeration_type() == kWaveEnumeration) {
+ // Utilize the Wave API for Windows XP.
+ GetInputDeviceNamesWinXP(device_names);
+ } else {
+ // Utilize the MMDevice API (part of Core Audio) for Vista and higher.
+ GetInputDeviceNamesWin(device_names);
+ }
+
+ // Always add default device parameters as first element.
+ if (!device_names->empty()) {
media::AudioDeviceName name;
name.device_name = AudioManagerBase::kDefaultDeviceName;
name.unique_id = AudioManagerBase::kDefaultDeviceId;
- device_names->push_back(name);
+ device_names->push_front(name);
}
}
-// static
+/// static
AudioManager* AudioManager::CreateAudioManager() {
return new AudioManagerWin();
}
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/audio/win/device_enumeration_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698