summaryrefslogtreecommitdiffstats
path: root/media/audio
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 20:43:09 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 20:43:09 +0000
commitbb1d3cabef77556677416988c9293a3b72d9c7cf (patch)
treeaf1074e5cff44fa5b97bcb49d985480b5eebd5d3 /media/audio
parente798e192afce58d16bb369567e9ade74f396649b (diff)
downloadchromium_src-bb1d3cabef77556677416988c9293a3b72d9c7cf.zip
chromium_src-bb1d3cabef77556677416988c9293a3b72d9c7cf.tar.gz
chromium_src-bb1d3cabef77556677416988c9293a3b72d9c7cf.tar.bz2
AudioHardwareGetProperty is deprecated in Mac OS X 10.6 ("Snow Leopard").
All audio hardware properties can be accessed via AudioObjectGetPropertyData, present since Mac OS X 10.4 ("Tiger"). BUG=20925 sort of TEST=Builds in all sorts of configurations Review URL: http://codereview.chromium.org/210009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
-rw-r--r--media/audio/mac/audio_manager_mac.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index a921dfb..ee5943a 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -10,11 +10,21 @@
#include "media/audio/mac/audio_output_mac.h"
bool AudioManagerMac::HasAudioDevices() {
- AudioDeviceID output_device_id = 0;
- size_t size = sizeof(output_device_id);
- OSStatus err = AudioHardwareGetProperty(
- kAudioHardwarePropertyDefaultOutputDevice, &size, &output_device_id);
- return ((err == noErr) && (output_device_id > 0));
+ AudioDeviceID output_device_id = kAudioObjectUnknown;
+ AudioObjectPropertyAddress property_address = {
+ kAudioHardwarePropertyDefaultOutputDevice, // mSelector
+ kAudioObjectPropertyScopeGlobal, // mScope
+ kAudioObjectPropertyElementMaster // mElement
+ };
+ size_t output_device_id_size = sizeof(output_device_id);
+ OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &property_address,
+ 0, // inQualifierDataSize
+ NULL, // inQualifierData
+ &output_device_id_size,
+ &output_device_id);
+ return err == kAudioHardwareNoError &&
+ output_device_id != kAudioObjectUnknown;
}
AudioOutputStream* AudioManagerMac::MakeAudioStream(Format format, int channels,