alsa_sound: Remove pcm stream close for flushing buffers
- Currently pcm stream is closed to flush buffers while switching
between speaker+headset combo device and headset device.
- Fix this problem by removing unnecessary pcm stream close.
Bug-id: 7051374
Change-Id: Id2faaeadd2a8e009f67e85beee42bbfe47b959f4
diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp
index 0fd9f83..1754a82 100644
--- a/alsa_sound/alsa_default.cpp
+++ b/alsa_sound/alsa_default.cpp
@@ -412,22 +412,6 @@
rxDevice = getUCMDevice(devices & AudioSystem::DEVICE_OUT_ALL, 0, NULL);
txDevice = getUCMDevice(devices & AudioSystem::DEVICE_IN_ALL, 1, rxDevice);
- if (rxDevice != NULL) {
- if ((handle->handle) && (((!strncmp(rxDevice, DEVICE_SPEAKER_HEADSET, strlen(DEVICE_SPEAKER_HEADSET))) &&
- ((!strncmp(curRxUCMDevice, DEVICE_HEADPHONES, strlen(DEVICE_HEADPHONES))) ||
- (!strncmp(curRxUCMDevice, DEVICE_HEADSET, strlen(DEVICE_HEADSET))))) ||
- (((!strncmp(curRxUCMDevice, DEVICE_SPEAKER_HEADSET, strlen(DEVICE_SPEAKER_HEADSET))) &&
- ((!strncmp(rxDevice, DEVICE_HEADPHONES, strlen(DEVICE_HEADPHONES))) ||
- (!strncmp(rxDevice, DEVICE_HEADSET, strlen(DEVICE_HEADSET))))))) &&
- ((!strncmp(handle->useCase, SND_USE_CASE_VERB_HIFI, strlen(SND_USE_CASE_VERB_HIFI))) ||
- (!strncmp(handle->useCase, SND_USE_CASE_MOD_PLAY_MUSIC, strlen(SND_USE_CASE_MOD_PLAY_MUSIC))))) {
- pcm_close(handle->handle);
- handle->handle=NULL;
- handle->rxHandle=NULL;
- pflag = true;
- }
- }
-
if ((rxDevice != NULL) && (txDevice != NULL)) {
if (((strncmp(rxDevice, curRxUCMDevice, MAX_STR_LEN)) ||
(strncmp(txDevice, curTxUCMDevice, MAX_STR_LEN))) && (mode == AudioSystem::MODE_IN_CALL))
@@ -643,7 +627,7 @@
}
if (handle->channels == 1) {
flags |= PCM_MONO;
- }
+ }
#ifdef QCOM_SSR_ENABLED
else if (handle->channels == 4 ) {
flags |= PCM_QUAD;
@@ -654,7 +638,7 @@
} else {
flags |= PCM_5POINT1;
}
- }
+ }
#endif
else {
flags |= PCM_STEREO;
@@ -1108,7 +1092,7 @@
static status_t s_standby(alsa_handle_t *handle)
{
int ret;
- status_t err = NO_ERROR;
+ status_t err = NO_ERROR;
struct pcm *h = handle->rxHandle;
handle->rxHandle = 0;
#if LOCAL_LOGD
@@ -1495,7 +1479,7 @@
err = csd_client_volume(vol);
if (err < 0) {
ALOGE("s_set_voice_volume: csd_client error %d", err);
- }
+ }
#endif
}
}