summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McNeil <sean.mcneil@windriver.com>2010-06-23 14:22:01 +0700
committerSean McNeil <sean.mcneil@windriver.com>2010-06-23 14:22:01 +0700
commit305796ac898ef9c22190068bff61bb4c5cbedf8b (patch)
treebca4602b918586a90a9c67ca654dd3e9c1d1f281
parentea8204987174398042729605860841637ad06888 (diff)
downloadalsa_sound-305796ac898ef9c22190068bff61bb4c5cbedf8b.tar.gz
Fix A2DP compilation, remove FM routing, use snd_pcm_hw_params_set_buffer_size_near
-rw-r--r--ALSAMixer.cpp1
-rw-r--r--Android.mk1
-rw-r--r--AudioPolicyManagerALSA.cpp61
-rw-r--r--alsa_default.cpp6
4 files changed, 22 insertions, 47 deletions
diff --git a/ALSAMixer.cpp b/ALSAMixer.cpp
index 883edf1..8bae00a 100644
--- a/ALSAMixer.cpp
+++ b/ALSAMixer.cpp
@@ -74,7 +74,6 @@ mixerProp[][SND_PCM_STREAM_LAST+1] = {
ALSA_PROP(AudioSystem::DEVICE_OUT_WIRED_HEADSET, "headset", "Headphone", "Capture"),
ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "bluetooth.sco", "Bluetooth", "Bluetooth Capture"),
ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "bluetooth.a2dp", "Bluetooth A2DP", "Bluetooth A2DP Capture"),
- ALSA_PROP(AudioSystem::DEVICE_OUT_FM_HEADPHONE, "fm", "FM", ""),
ALSA_PROP(static_cast<AudioSystem::audio_devices>(0), "", NULL, NULL)
};
diff --git a/Android.mk b/Android.mk
index f9b1781..099cdda 100644
--- a/Android.mk
+++ b/Android.mk
@@ -46,6 +46,7 @@ endif
include $(CLEAR_VARS)
LOCAL_CFLAGS := -D_POSIX_SOURCE
+
ifeq ($(BOARD_HAVE_BLUETOOTH),true)
LOCAL_CFLAGS += -DWITH_A2DP
endif
diff --git a/AudioPolicyManagerALSA.cpp b/AudioPolicyManagerALSA.cpp
index b7808c9..8f93503 100644
--- a/AudioPolicyManagerALSA.cpp
+++ b/AudioPolicyManagerALSA.cpp
@@ -214,6 +214,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
newDevice = device;
}
+#ifdef SUPPORT_DEVICE_OUT_TTY
} else if (device == AudioSystem::DEVICE_OUT_TTY) {
LOGV("setDeviceConnectionState() tty device");
// if connecting a wired headset, we check the following by order of priority
@@ -225,22 +226,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
newDevice = device;
}
- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
- LOGV("setDeviceConnectionState() no mic headphone device");
- // if connecting a wired headset, we check the following by order of priority
- // to request a routing change if necessary:
- // 1: the strategy sonification is active on the hardware output:
- // use device for strategy sonification
- // 2: the strategy media is active on the hardware output:
- // use device for strategy media
- if ((getDeviceForStrategy(STRATEGY_SONIFICATION) & device) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
- } else if ((getDeviceForStrategy(STRATEGY_MEDIA) == device) &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
- newDevice = device;
- }
+#endif // SUPPORT_DEVICE_OUT_TTY
}
// request routing change if necessary
@@ -390,6 +376,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)){
newDevice = getDeviceForStrategy(STRATEGY_DTMF);
}
+#ifdef SUPPORT_DEVICE_OUT_TTY
} else if (device == AudioSystem::DEVICE_OUT_TTY) {
LOGV("setDeviceConnectionState() tty device");
if (wasUsedforPhone &&
@@ -397,18 +384,10 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
newDevice = getDeviceForStrategy(STRATEGY_PHONE);
}
- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
- LOGV("setDeviceConnectionState() no mic headphone device");
- if (wasUsedForSonification &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
- } else if (wasUsedForMedia &&
- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
- newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
- }
+#endif // SUPPORT_DEVICE_OUT_TTY
}
}
+
// request routing change if necessary
setOutputDevice(mHardwareOutput, newDevice);
@@ -1345,8 +1324,10 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
// FALL THROUGH
default: // FORCE_NONE
+#ifdef SUPPORT_DEVICE_OUT_TTY
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_TTY;
if (device) break;
+#endif // SUPPORT_DEVICE_OUT_TTY
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
@@ -1362,7 +1343,7 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
if (device) break;
}
- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
+ device = mAvailableOutputDevices;
if (device) break;
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
if (device == 0) {
@@ -1396,22 +1377,16 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
if (device2 == 0) {
device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_HEADPHONE;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
- if (device2 == 0) {
- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
- if (device2 == 0) {
- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
- if (device == 0) {
- LOGE("getDeviceForStrategy() speaker device not found");
- }
- }
- }
- }
- }
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
+ if (device2 == 0) {
+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
+ if (device2 == 0) {
+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
+ if (device == 0) {
+ LOGE("getDeviceForStrategy() speaker device not found");
+ }
+ }
+ }
}
}
}
diff --git a/alsa_default.cpp b/alsa_default.cpp
index 1951498..d437f37 100644
--- a/alsa_default.cpp
+++ b/alsa_default.cpp
@@ -138,7 +138,6 @@ static const device_suffix_t deviceSuffix[] = {
{AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "_Bluetooth"},
{AudioSystem::DEVICE_OUT_WIRED_HEADSET, "_Headset"},
{AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "_Bluetooth-A2DP"},
- {AudioSystem::DEVICE_OUT_FM_HEADPHONE, "_FM"},
};
static const int deviceSuffixLen = (sizeof(deviceSuffix)
@@ -278,8 +277,9 @@ status_t setHardwareParams(alsa_handle_t *handle)
#endif
// Make sure we have at least the size we originally wanted
- err = snd_pcm_hw_params_set_buffer_size(handle->handle, hardwareParams,
- bufferSize);
+ err = snd_pcm_hw_params_set_buffer_size_near(handle->handle, hardwareParams,
+ &bufferSize);
+
if (err < 0) {
LOGE("Unable to set buffer size to %d: %s",
(int)bufferSize, snd_strerror(err));