Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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: Ie2a200470c16da2e4ae991c0814ec8dfb4666833
Signed-off-by: Iliyan Malchev <malchev@google.com>
  • Loading branch information...
commit f859d3e80b790d4b525515918f1c6889383cc495 1 parent 7778038
SathishKumar Mani authored Iliyan Malchev committed
2  alsa_sound/ALSAStreamOps.cpp
@@ -61,7 +61,6 @@ ALSAStreamOps::~ALSAStreamOps()
61 61 }
62 62 }
63 63 mParent->mVoipStreamCount = 0;
64   - mParent->mVoipMicMute = 0;
65 64 mParent->mVoipBitRate = 0;
66 65 }
67 66 close();
@@ -348,7 +347,6 @@ void ALSAStreamOps::close()
348 347 ALOGD("close");
349 348 if((!strncmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL, strlen(SND_USE_CASE_VERB_IP_VOICECALL))) ||
350 349 (!strncmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP, strlen(SND_USE_CASE_MOD_PLAY_VOIP)))) {
351   - mParent->mVoipMicMute = false;
352 350 mParent->mVoipBitRate = 0;
353 351 mParent->mVoipStreamCount = 0;
354 352 }
36 alsa_sound/AudioHardwareALSA.cpp
@@ -71,7 +71,7 @@ AudioHardwareInterface *AudioHardwareALSA::create() {
71 71 }
72 72
73 73 AudioHardwareALSA::AudioHardwareALSA() :
74   - mALSADevice(0),mVoipStreamCount(0),mVoipMicMute(false),mVoipBitRate(0)
  74 + mALSADevice(0),mVoipStreamCount(0),mVoipBitRate(0)
75 75 ,mCallState(0),mAcdbHandle(NULL),mCsdHandle(NULL)
76 76 {
77 77 FILE *fp;
@@ -737,7 +737,6 @@ AudioHardwareALSA::openOutputStream(uint32_t devices,
737 737 }
738 738 if(voipstream_active == false) {
739 739 mVoipStreamCount = 0;
740   - mVoipMicMute = false;
741 740 alsa_handle_t alsa_handle;
742 741 unsigned long bufferSize;
743 742 if(*sampleRate == VOIP_SAMPLING_RATE_8K) {
@@ -1032,7 +1031,6 @@ AudioHardwareALSA::openInputStream(uint32_t devices,
1032 1031 }
1033 1032 if(voipstream_active == false) {
1034 1033 mVoipStreamCount = 0;
1035   - mVoipMicMute = false;
1036 1034 alsa_handle_t alsa_handle;
1037 1035 unsigned long bufferSize;
1038 1036 if(*sampleRate == VOIP_SAMPLING_RATE_8K) {
@@ -1291,26 +1289,11 @@ AudioHardwareALSA::closeInputStream(AudioStreamIn* in)
1291 1289
1292 1290 status_t AudioHardwareALSA::setMicMute(bool state)
1293 1291 {
1294   - int newMode = mode();
1295   - ALOGD("setMicMute newMode %d",newMode);
1296   - if(newMode == AudioSystem::MODE_IN_COMMUNICATION) {
1297   - if (mVoipMicMute != state) {
1298   - mVoipMicMute = state;
1299   - ALOGD("setMicMute: mVoipMicMute %d", mVoipMicMute);
1300   - if(mALSADevice) {
1301   - mALSADevice->setVoipMicMute(state);
1302   - }
1303   - }
1304   - } else {
1305   - if (mMicMute != state) {
1306   - mMicMute = state;
1307   - ALOGD("setMicMute: mMicMute %d", mMicMute);
1308   - if(mALSADevice) {
1309   - if(mCSCallActive == CS_ACTIVE)
1310   - mALSADevice->setMicMute(state);
1311   - if(mVolteCallActive == IMS_ACTIVE)
1312   - mALSADevice->setVoLTEMicMute(state);
1313   - }
  1292 + if (mMicMute != state) {
  1293 + mMicMute = state;
  1294 + ALOGD("setMicMute: mMicMute %d", mMicMute);
  1295 + if(mALSADevice) {
  1296 + mALSADevice->setMicMute(state);
1314 1297 }
1315 1298 }
1316 1299 return NO_ERROR;
@@ -1318,12 +1301,7 @@ status_t AudioHardwareALSA::setMicMute(bool state)
1318 1301
1319 1302 status_t AudioHardwareALSA::getMicMute(bool *state)
1320 1303 {
1321   - int newMode = mode();
1322   - if(newMode == AudioSystem::MODE_IN_COMMUNICATION) {
1323   - *state = mVoipMicMute;
1324   - } else {
1325   - *state = mMicMute;
1326   - }
  1304 + *state = mMicMute;
1327 1305 return NO_ERROR;
1328 1306 }
1329 1307
1  alsa_sound/AudioHardwareALSA.h
@@ -566,7 +566,6 @@ class AudioHardwareALSA : public AudioHardwareBase
566 566 * Settings and Qualcomm Settings applications */
567 567 uint32_t mDevSettingsFlag;
568 568 uint32_t mVoipStreamCount;
569   - bool mVoipMicMute;
570 569 uint32_t mVoipBitRate;
571 570 uint32_t mIncallMode;
572 571
5 alsa_sound/AudioStreamInALSA.cpp
@@ -445,6 +445,10 @@ ssize_t AudioStreamInALSA::read(void *buffer, ssize_t bytes)
445 445 else {
446 446 read += static_cast<ssize_t>((period_size));
447 447 read_pending -= period_size;
  448 + //Set mute by cleanning buffers read
  449 + if (mParent->mMicMute) {
  450 + memset(buffer, 0, period_size);
  451 + }
448 452 buffer = ((uint8_t *)buffer) + period_size;
449 453 }
450 454
@@ -491,7 +495,6 @@ status_t AudioStreamInALSA::close()
491 495 return NO_ERROR;
492 496 }
493 497 mParent->mVoipStreamCount = 0;
494   - mParent->mVoipMicMute = 0;
495 498 #ifdef QCOM_USBAUDIO_ENABLED
496 499 } else {
497 500 ALOGD("Deregistering REC bit, musbRecordingState:%d", mParent->musbRecordingState);
1  alsa_sound/AudioStreamOutALSA.cpp
@@ -299,7 +299,6 @@ status_t AudioStreamOutALSA::close()
299 299 return NO_ERROR;
300 300 }
301 301 mParent->mVoipStreamCount = 0;
302   - mParent->mVoipMicMute = 0;
303 302 }
304 303 #ifdef QCOM_USBAUDIO_ENABLED
305 304 else if((!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOW_POWER)) ||

0 comments on commit f859d3e

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