Skip to content
Browse files

alsa_sound: fix for SIP call mute issue.

-Mute VOIP through audio path is not supported by kernel,
 so calling setVoipMicMute() to disable ""Voip Tx Mute"" fails
-Mute VOIP by cleanning buffers read if setMicMute is set
-Remove mVoipMicMute and use mMicMute for voice and VOIP

Bug: 7213748
Change-Id: I62be8456447425cbd1521083782802effcb6d326
Signed-off-by: Iliyan Malchev <malchev@google.com>
  • Loading branch information...
1 parent 80baa42 commit 6ccde10fdc6591e5cd21ed32c2b5817aaeb1a208 SathishKumar Mani committed with Iliyan Malchev Sep 26, 2012
View
2 alsa_sound/ALSAStreamOps.cpp
@@ -61,7 +61,6 @@ ALSAStreamOps::~ALSAStreamOps()
}
}
mParent->mVoipStreamCount = 0;
- mParent->mVoipMicMute = 0;
mParent->mVoipBitRate = 0;
}
close();
@@ -352,7 +351,6 @@ void ALSAStreamOps::close()
ALOGD("close");
if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
(!strncmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP, strlen(SND_USE_CASE_MOD_PLAY_VOIP)))) {
- mParent->mVoipMicMute = false;
mParent->mVoipBitRate = 0;
mParent->mVoipStreamCount = 0;
}
View
38 alsa_sound/AudioHardwareALSA.cpp
@@ -71,8 +71,8 @@ AudioHardwareInterface *AudioHardwareALSA::create() {
}
AudioHardwareALSA::AudioHardwareALSA() :
- mALSADevice(0),mVoipStreamCount(0),mVoipMicMute(false),mVoipBitRate(0)
- ,mCallState(0),mAcdbHandle(NULL),mCsdHandle(NULL)
+ mALSADevice(0),mVoipStreamCount(0),mVoipBitRate(0)
+ ,mCallState(0),mAcdbHandle(NULL),mCsdHandle(NULL),mMicMute(0)
{
FILE *fp;
char soundCardInfo[200];
@@ -737,7 +737,6 @@ AudioHardwareALSA::openOutputStream(uint32_t devices,
}
if(voipstream_active == false) {
mVoipStreamCount = 0;
- mVoipMicMute = false;
alsa_handle_t alsa_handle;
unsigned long bufferSize;
if(*sampleRate == VOIP_SAMPLING_RATE_8K) {
@@ -1032,7 +1031,6 @@ AudioHardwareALSA::openInputStream(uint32_t devices,
}
if(voipstream_active == false) {
mVoipStreamCount = 0;
- mVoipMicMute = false;
alsa_handle_t alsa_handle;
unsigned long bufferSize;
if(*sampleRate == VOIP_SAMPLING_RATE_8K) {
@@ -1291,39 +1289,19 @@ AudioHardwareALSA::closeInputStream(AudioStreamIn* in)
status_t AudioHardwareALSA::setMicMute(bool state)
{
- int newMode = mode();
- ALOGD("setMicMute newMode %d",newMode);
- if(newMode == AudioSystem::MODE_IN_COMMUNICATION) {
- if (mVoipMicMute != state) {
- mVoipMicMute = state;
- ALOGD("setMicMute: mVoipMicMute %d", mVoipMicMute);
- if(mALSADevice) {
- mALSADevice->setVoipMicMute(state);
- }
- }
- } else {
- if (mMicMute != state) {
- mMicMute = state;
- ALOGD("setMicMute: mMicMute %d", mMicMute);
- if(mALSADevice) {
- if(mCSCallActive == CS_ACTIVE)
- mALSADevice->setMicMute(state);
- if(mVolteCallActive == IMS_ACTIVE)
- mALSADevice->setVoLTEMicMute(state);
- }
+ if (mMicMute != state) {
+ mMicMute = state;
+ ALOGD("setMicMute: mMicMute %d", mMicMute);
+ if(mALSADevice) {
+ mALSADevice->setMicMute(state);
}
}
return NO_ERROR;
}
status_t AudioHardwareALSA::getMicMute(bool *state)
{
- int newMode = mode();
- if(newMode == AudioSystem::MODE_IN_COMMUNICATION) {
- *state = mVoipMicMute;
- } else {
- *state = mMicMute;
- }
+ *state = mMicMute;
return NO_ERROR;
}
View
1 alsa_sound/AudioHardwareALSA.h
@@ -566,7 +566,6 @@ class AudioHardwareALSA : public AudioHardwareBase
* Settings and Qualcomm Settings applications */
uint32_t mDevSettingsFlag;
uint32_t mVoipStreamCount;
- bool mVoipMicMute;
uint32_t mVoipBitRate;
uint32_t mIncallMode;
View
5 alsa_sound/AudioStreamInALSA.cpp
@@ -445,6 +445,10 @@ ssize_t AudioStreamInALSA::read(void *buffer, ssize_t bytes)
else {
read += static_cast<ssize_t>((period_size));
read_pending -= period_size;
+ //Set mute by cleanning buffers read
+ if (mParent->mMicMute) {
+ memset(buffer, 0, period_size);
+ }
buffer = ((uint8_t *)buffer) + period_size;
}
@@ -491,7 +495,6 @@ status_t AudioStreamInALSA::close()
return NO_ERROR;
}
mParent->mVoipStreamCount = 0;
- mParent->mVoipMicMute = 0;
#ifdef QCOM_USBAUDIO_ENABLED
} else {
ALOGD("Deregistering REC bit, musbRecordingState:%d", mParent->musbRecordingState);
View
1 alsa_sound/AudioStreamOutALSA.cpp
@@ -299,7 +299,6 @@ status_t AudioStreamOutALSA::close()
return NO_ERROR;
}
mParent->mVoipStreamCount = 0;
- mParent->mVoipMicMute = 0;
}
#ifdef QCOM_USBAUDIO_ENABLED
else if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||

0 comments on commit 6ccde10

Please sign in to comment.
Something went wrong with that request. Please try again.