diff options
| author | sbrissen <sbrissen@hotmail.com> | 2013-02-20 09:28:33 -0500 |
|---|---|---|
| committer | sbrissen <sbrissen@hotmail.com> | 2013-02-20 09:28:33 -0500 |
| commit | ae19adda34e67b96d32019b8f36ab16d6300b825 (patch) | |
| tree | f25f4621e5cd30f408a1c57285fa2694f619ca08 | |
| parent | a384bdeebf3a6f96d3372d142d321d7cb0e6b1b4 (diff) | |
| download | device_samsung_t0lte-ae19adda34e67b96d32019b8f36ab16d6300b825.tar.gz device_samsung_t0lte-ae19adda34e67b96d32019b8f36ab16d6300b825.tar.bz2 device_samsung_t0lte-ae19adda34e67b96d32019b8f36ab16d6300b825.zip | |
t0lte: Fix switching incall devices
This fixes switching incall devices with the bt incall fix.
Change-Id: I72a7c6046a8ab63a6f9e31876a794abda3c3c612
| -rwxr-xr-x | audio/audio_hw.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index bf03a46..4962363 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -195,7 +195,7 @@ struct m0_dev_cfg { #define CSD_CLIENT_LIBPATH "/system/lib/libcsd-client.so" void *mCsdHandle; -int rx_dev_id, tx_dev_id; +int rx_dev_id, tx_dev_id, old_rx_dev; int voice_index; static int (*csd_client_init)(); @@ -502,7 +502,7 @@ static void end_call(struct m0_audio_device *adev) adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; - if (bt_on) { + if (bt_on || old_rx_dev == DEVICE_BT_SCO_RX_ACDB_ID) { if (adev->pcm_bt_dl != NULL) { ALOGD("Stopping bluetooth DL PCM"); pcm_stop(adev->pcm_bt_dl); @@ -558,7 +558,7 @@ static void set_incall_device(struct m0_audio_device *adev) rx_dev_id = DEVICE_BT_SCO_RX_ACDB_ID; tx_dev_id = DEVICE_BT_SCO_TX_ACDB_ID; } - voice_index = 5; + voice_index = 7; break; default: rx_dev_id = DEVICE_HANDSET_RX_ACDB_ID; @@ -594,13 +594,14 @@ static void set_incall_device(struct m0_audio_device *adev) adev_set_voice_volume(&adev->hw_device, adev->voice_volume); - /* when switching devices to or from BT we need to stop the modem pcm to change - the rate to or from amr_nb */ - if(adev->in_call){ - end_call(adev); + /* Restart pcm only if switching off or onto bt to adjust to amr */ + if(old_rx_dev == DEVICE_BT_SCO_RX_ACDB_ID || rx_dev_id == DEVICE_BT_SCO_RX_ACDB_ID){ + ALOGI("%s: old_rx_dev: %i", __func__, old_rx_dev); + end_call(adev); + start_call(adev); } - start_call(adev); + old_rx_dev = rx_dev_id; } static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, @@ -659,6 +660,7 @@ static void select_mode(struct m0_audio_device *adev) } else adev->out_device &= ~AUDIO_DEVICE_OUT_SPEAKER; select_output_device(adev); + start_call(adev); adev->in_call = 1; } } else { @@ -783,9 +785,6 @@ static void select_output_device(struct m0_audio_device *adev) } if (bt_on) { - // bt uses a different port (PORT_BT) for playback, reopen the pcms - end_call(adev); - start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); set_bigroute_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); |
