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

Commit a1a9ee0c authored by kunleiz's avatar kunleiz
Browse files

hal: Fix VoIP Mute failure in SIP call during Voice call HOLD

- Unable to apply the mute in MT SIP call during Voice call
  in CALL_HOLD.
- Mute is only applied if the voice call state is INACTIVE.
  Thus when SIP call is made during Voice call in CALL_HOLD,
  the mute is not being reflected.
- Fix this issue by checking voice stream type to allow
  the mute to be applied.

Change-Id: I3af5225edd8e9a4123867b647de9405d5c4b9efc
CRs-Fixed: 642893
parent a593da0c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1977,7 +1977,7 @@ 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.
     */
    if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call(adev))
    if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call_rec_stream(in))
        memset(buffer, 0, bytes);

exit:
+13 −0
Original line number Diff line number Diff line
@@ -189,6 +189,19 @@ bool voice_is_in_call(struct audio_device *adev)
    return in_call;
}

bool voice_is_in_call_rec_stream(struct stream_in *in)
{
    bool in_call_rec = false;
    int ret = 0;

    ret = voice_extn_is_in_call_rec_stream(in, &in_call_rec);
    if (ret == -ENOSYS) {
        in_call_rec = false;
    }

    return in_call_rec;
}

uint32_t voice_get_active_session_id(struct audio_device *adev)
{
    int ret = 0;
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ void voice_get_parameters(struct audio_device *adev, struct str_parms *query,
                          struct str_parms *reply);
void voice_init(struct audio_device *adev);
bool voice_is_in_call(struct audio_device *adev);
bool voice_is_in_call_rec_stream(struct stream_in *in);
int voice_set_mic_mute(struct audio_device *dev, bool state);
bool voice_get_mic_mute(struct audio_device *dev);
int voice_set_volume(struct audio_device *adev, float volume);
+13 −0
Original line number Diff line number Diff line
@@ -356,6 +356,19 @@ int voice_extn_is_in_call(struct audio_device *adev, bool *in_call)
    return 0;
}

int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
{
    *in_call_rec = false;

    if(in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
       in->source == AUDIO_SOURCE_VOICE_UPLINK ||
       in->source == AUDIO_SOURCE_VOICE_CALL) {
       *in_call_rec = true;
    }

    return 0;
}

void voice_extn_init(struct audio_device *adev)
{
    adev->voice.session[VOICE_SESS_IDX].vsid =  VOICE_VSID;
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ void voice_extn_get_parameters(const struct audio_device *adev,
                               struct str_parms *query,
                               struct str_parms *reply);
int voice_extn_is_in_call(struct audio_device *adev, bool *in_call);
int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec);
int voice_extn_get_active_session_id(struct audio_device *adev,
                                     uint32_t *session_id);
void voice_extn_in_get_parameters(struct stream_in *in,
@@ -80,6 +81,11 @@ static int voice_extn_is_in_call(struct audio_device *adev, bool *in_call)
    return -ENOSYS;
}

static int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
{
    return -ENOSYS;
}

static int voice_extn_get_active_session_id(struct audio_device *adev,
                                            uint32_t *session_id)
{