Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-alsa_sound: 提交

hardware/alsa_sound


Commit MetaInfo

修订版305796ac898ef9c22190068bff61bb4c5cbedf8b (tree)
时间2010-06-23 16:22:01
作者Sean McNeil <sean.mcneil@wind...>
CommiterSean McNeil

Log Message

Fix A2DP compilation, remove FM routing, use snd_pcm_hw_params_set_buffer_size_near

更改概述

差异

--- a/ALSAMixer.cpp
+++ b/ALSAMixer.cpp
@@ -74,7 +74,6 @@ mixerProp[][SND_PCM_STREAM_LAST+1] = {
7474 ALSA_PROP(AudioSystem::DEVICE_OUT_WIRED_HEADSET, "headset", "Headphone", "Capture"),
7575 ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "bluetooth.sco", "Bluetooth", "Bluetooth Capture"),
7676 ALSA_PROP(AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "bluetooth.a2dp", "Bluetooth A2DP", "Bluetooth A2DP Capture"),
77- ALSA_PROP(AudioSystem::DEVICE_OUT_FM_HEADPHONE, "fm", "FM", ""),
7877 ALSA_PROP(static_cast<AudioSystem::audio_devices>(0), "", NULL, NULL)
7978 };
8079
--- a/Android.mk
+++ b/Android.mk
@@ -46,6 +46,7 @@ endif
4646 include $(CLEAR_VARS)
4747
4848 LOCAL_CFLAGS := -D_POSIX_SOURCE
49+
4950 ifeq ($(BOARD_HAVE_BLUETOOTH),true)
5051 LOCAL_CFLAGS += -DWITH_A2DP
5152 endif
--- a/AudioPolicyManagerALSA.cpp
+++ b/AudioPolicyManagerALSA.cpp
@@ -214,6 +214,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
214214 mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)) {
215215 newDevice = device;
216216 }
217+#ifdef SUPPORT_DEVICE_OUT_TTY
217218 } else if (device == AudioSystem::DEVICE_OUT_TTY) {
218219 LOGV("setDeviceConnectionState() tty device");
219220 // if connecting a wired headset, we check the following by order of priority
@@ -225,22 +226,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
225226 mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
226227 newDevice = device;
227228 }
228- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
229- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
230- LOGV("setDeviceConnectionState() no mic headphone device");
231- // if connecting a wired headset, we check the following by order of priority
232- // to request a routing change if necessary:
233- // 1: the strategy sonification is active on the hardware output:
234- // use device for strategy sonification
235- // 2: the strategy media is active on the hardware output:
236- // use device for strategy media
237- if ((getDeviceForStrategy(STRATEGY_SONIFICATION) & device) &&
238- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
239- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
240- } else if ((getDeviceForStrategy(STRATEGY_MEDIA) == device) &&
241- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
242- newDevice = device;
243- }
229+#endif // SUPPORT_DEVICE_OUT_TTY
244230 }
245231
246232 // request routing change if necessary
@@ -390,6 +376,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
390376 mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_DTMF)){
391377 newDevice = getDeviceForStrategy(STRATEGY_DTMF);
392378 }
379+#ifdef SUPPORT_DEVICE_OUT_TTY
393380 } else if (device == AudioSystem::DEVICE_OUT_TTY) {
394381 LOGV("setDeviceConnectionState() tty device");
395382 if (wasUsedforPhone &&
@@ -397,18 +384,10 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev
397384 mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_PHONE))) {
398385 newDevice = getDeviceForStrategy(STRATEGY_PHONE);
399386 }
400- } else if (device == AudioSystem::DEVICE_OUT_FM_SPEAKER ||
401- device == AudioSystem::DEVICE_OUT_FM_HEADPHONE) {
402- LOGV("setDeviceConnectionState() no mic headphone device");
403- if (wasUsedForSonification &&
404- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_SONIFICATION)){
405- newDevice = getDeviceForStrategy(STRATEGY_SONIFICATION);
406- } else if (wasUsedForMedia &&
407- mOutputs.valueFor(mHardwareOutput)->isUsedByStrategy(STRATEGY_MEDIA)){
408- newDevice = getDeviceForStrategy(STRATEGY_MEDIA);
409- }
387+#endif // SUPPORT_DEVICE_OUT_TTY
410388 }
411389 }
390+
412391 // request routing change if necessary
413392 setOutputDevice(mHardwareOutput, newDevice);
414393
@@ -1345,8 +1324,10 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
13451324 // FALL THROUGH
13461325
13471326 default: // FORCE_NONE
1327+#ifdef SUPPORT_DEVICE_OUT_TTY
13481328 device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_TTY;
13491329 if (device) break;
1330+#endif // SUPPORT_DEVICE_OUT_TTY
13501331 device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
13511332 if (device) break;
13521333 device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
@@ -1362,7 +1343,7 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
13621343 device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT;
13631344 if (device) break;
13641345 }
1365- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
1346+ device = mAvailableOutputDevices;
13661347 if (device) break;
13671348 device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
13681349 if (device == 0) {
@@ -1396,22 +1377,16 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy)
13961377 if (device2 == 0) {
13971378 device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER;
13981379 if (device2 == 0) {
1399- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_HEADPHONE;
1400- if (device2 == 0) {
1401- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_FM_SPEAKER;
1402- if (device2 == 0) {
1403- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
1404- if (device2 == 0) {
1405- device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
1406- if (device2 == 0) {
1407- device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
1408- if (device == 0) {
1409- LOGE("getDeviceForStrategy() speaker device not found");
1410- }
1411- }
1412- }
1413- }
1414- }
1380+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADPHONE;
1381+ if (device2 == 0) {
1382+ device2 = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_WIRED_HEADSET;
1383+ if (device2 == 0) {
1384+ device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
1385+ if (device == 0) {
1386+ LOGE("getDeviceForStrategy() speaker device not found");
1387+ }
1388+ }
1389+ }
14151390 }
14161391 }
14171392 }
--- a/alsa_default.cpp
+++ b/alsa_default.cpp
@@ -138,7 +138,6 @@ static const device_suffix_t deviceSuffix[] = {
138138 {AudioSystem::DEVICE_OUT_BLUETOOTH_SCO, "_Bluetooth"},
139139 {AudioSystem::DEVICE_OUT_WIRED_HEADSET, "_Headset"},
140140 {AudioSystem::DEVICE_OUT_BLUETOOTH_A2DP, "_Bluetooth-A2DP"},
141- {AudioSystem::DEVICE_OUT_FM_HEADPHONE, "_FM"},
142141 };
143142
144143 static const int deviceSuffixLen = (sizeof(deviceSuffix)
@@ -278,8 +277,9 @@ status_t setHardwareParams(alsa_handle_t *handle)
278277 #endif
279278
280279 // Make sure we have at least the size we originally wanted
281- err = snd_pcm_hw_params_set_buffer_size(handle->handle, hardwareParams,
282- bufferSize);
280+ err = snd_pcm_hw_params_set_buffer_size_near(handle->handle, hardwareParams,
281+ &bufferSize);
282+
283283 if (err < 0) {
284284 LOGE("Unable to set buffer size to %d: %s",
285285 (int)bufferSize, snd_strerror(err));
Show on old repository browser