Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b2b5ab2 authored by Eric Laurent's avatar Eric Laurent
Browse files

audio: fix mic mute for SIP calls

Do not allow mic mute only when in PSTN calls.

Bug: 17321604.
Change-Id: Ie82d4ea4de767c38e5d476d5827ebb9ae0c45c63
parent 4cc4ce1a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1832,8 +1832,9 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
    /*
     * Instead of writing zeroes here, we could trust the hardware
     * to always provide zeroes when muted.
     * No need to acquire adev->lock to read mic_muted here as we don't change its state.
     */
    if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call(adev))
    if (ret == 0 && adev->mic_muted && in->usecase != USECASE_AUDIO_RECORD_AFE_PROXY)
        memset(buffer, 0, bytes);

exit:
@@ -2303,6 +2304,7 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state)
    ALOGD("%s: state %d\n", __func__, state);
    pthread_mutex_lock(&adev->lock);
    ret = voice_set_mic_mute(adev, state);
    adev->mic_muted = state;
    pthread_mutex_unlock(&adev->lock);

    return ret;
+1 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ struct audio_device {
    struct voice voice;
    unsigned int cur_hdmi_channels;
    bool bt_wb_speech_enabled;
    bool mic_muted;

    int snd_card;
    void *platform;