Skip to content

Commit

Permalink
Fix headset call & Add missing define
Browse files Browse the repository at this point in the history
Change-Id: I14574e56faf86b68782aa9023ac6e44e8009a716
  • Loading branch information
huangqiwu committed Aug 1, 2013
1 parent 3537f9e commit 979945d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
13 changes: 6 additions & 7 deletions alsa_sound/ALSADevice.cpp
Expand Up @@ -2038,11 +2038,11 @@ char* ALSADevice::getUCMDevice(uint32_t devices, int input, char *rxDevice)
if (((rxDevice != NULL) &&
(!strncmp(rxDevice, SND_USE_CASE_DEV_SPEAKER,
(strlen(SND_USE_CASE_DEV_SPEAKER)+1))
#ifdef SEPERATED_VOICE_SPEAKER
/*#ifdef SEPERATED_VOICE_SPEAKER
|| !strncmp(rxDevice, SND_USE_CASE_DEV_VOC_SPEAKER,
(strlen(SND_USE_CASE_DEV_VOC_SPEAKER)+1))
#endif
)) ||
*/ )) ||
((rxDevice == NULL) &&
!strncmp(mCurRxUCMDevice, SND_USE_CASE_DEV_SPEAKER,
(strlen(SND_USE_CASE_DEV_SPEAKER)+1)))) {
Expand Down Expand Up @@ -2141,11 +2141,10 @@ char* ALSADevice::getUCMDevice(uint32_t devices, int input, char *rxDevice)
}
#endif
else {
if ((rxDevice != NULL) &&
!strncmp(rxDevice, SND_USE_CASE_DEV_ANC_HANDSET,
strlen(SND_USE_CASE_DEV_ANC_HANDSET) + 1)) {
return strdup(SND_USE_CASE_DEV_AANC_LINE); /* AANC LINE TX */
} else {
if (mCallMode == AudioSystem::MODE_IN_CALL) {
return strdup(SND_USE_CASE_DEV_VOC_LINE); /* VOICE BUILTIN-MIC TX */
}
else {
return strdup(SND_USE_CASE_DEV_LINE); /* BUILTIN-MIC TX */
}
}
Expand Down
10 changes: 8 additions & 2 deletions alsa_sound/AudioHardwareALSA.cpp
Expand Up @@ -356,6 +356,7 @@ AudioHardwareALSA::AudioHardwareALSA() :
pthread_create(&CSDInitThread, NULL, CSDInitThreadWrapper, this);
//csd_client_init();
}
//XIAOMI_END
}
//XIAOMI_START
mLoopbackState = 0;
Expand Down Expand Up @@ -511,8 +512,7 @@ status_t AudioHardwareALSA::setMasterVolume(float volume)
status_t AudioHardwareALSA::setMode(int mode)
{
status_t status = NO_ERROR;

ALOGV("%s() mode=%d mMode=%d", __func__, mode, mMode);
ALOGE("mMode:%d, mode:%d", mMode, mode);
//XIAOMI_START
if ((mMode == AUDIO_MODE_RINGTONE) &&
(mode == AUDIO_MODE_NORMAL)) {
Expand All @@ -521,6 +521,8 @@ status_t AudioHardwareALSA::setMode(int mode)
}
//XIAOMI_END

ALOGV("%s() mode=%d mMode=%d", __func__, mode, mMode);

if (mode != mMode) {
status = AudioHardwareBase::setMode(mode);
}
Expand All @@ -534,6 +536,7 @@ status_t AudioHardwareALSA::setMode(int mode)
}
//XIAOMI_END
}

if (mode == AUDIO_MODE_IN_CALL) {
//XIAOMI_START
if (mAudienceCmd == CMD_AUDIENCE_READY)
Expand Down Expand Up @@ -1205,6 +1208,9 @@ status_t AudioHardwareALSA::doRouting(int device)
setInChannels(device);
ALSAHandleList::iterator it = mDeviceList.end();
it--;
//XIAOMI_START
ALOGD("ALSADevice->route mode:%d, device:0x%x, enable:%d", newMode, device, true);
//XIAOMI_END
mALSADevice->route(&(*it), (uint32_t)device, newMode);
}
}
Expand Down
5 changes: 2 additions & 3 deletions alsa_sound/AudioHardwareALSA.h
Expand Up @@ -53,9 +53,6 @@ extern "C" {
#include <termios.h> /* POSIX terminal control definitions */

#define A200_msg_Sync_Polling 0x80000000
//#define BOTHER 0010000
//#define TCGETS2 _IOR('T', 0x2A, struct termios2)
//#define TCSETS2 _IOW('T', 0x2B, struct termios2)

#define PRESET_BASE 0x80310000
#define ES310_PRESET_HANDSET_INCALL_NB (PRESET_BASE)
Expand Down Expand Up @@ -157,6 +154,8 @@ class AudioHardwareALSA;
#define VOIP_SAMPLING_RATE_8K 8000
#define VOIP_SAMPLING_RATE_16K 16000
#define VOIP_DEFAULT_CHANNEL_MODE 1
#define VOIP_BUFFER_SIZE_8K 320
#define VOIP_BUFFER_SIZE_16K 640
#define VOIP_BUFFER_MAX_SIZE VOIP_BUFFER_SIZE_16K
#define VOIP_PLAYBACK_LATENCY 6400
#define VOIP_RECORD_LATENCY 6400
Expand Down

0 comments on commit 979945d

Please sign in to comment.