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

Commit 5a0129ac authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: Fix audio mute issue on MT call over a2dp"

parents 12e95089 03f9dd55
Loading
Loading
Loading
Loading
+32 −23
Original line number Diff line number Diff line
@@ -645,29 +645,13 @@ int audio_extn_a2dp_start_playback()
    return ret;
}

int audio_extn_a2dp_stop_playback()
static void reset_a2dp_enc_config_params()
{
    int ret =0;

    ALOGV("audio_extn_a2dp_stop_playback start");
    if(!(a2dp.bt_lib_handle && a2dp.audio_stop_stream)) {
        ALOGE("a2dp handle is not identified, Ignoring start request");
        return -ENOSYS;
    }

    if (a2dp.a2dp_started && (a2dp.a2dp_total_active_session_request > 0))
        a2dp.a2dp_total_active_session_request--;

    if ( a2dp.a2dp_started && !a2dp.a2dp_total_active_session_request) {
    struct mixer_ctl *ctl_enc_config, *ctrl_bit_format;
    struct sbc_enc_cfg_t dummy_reset_config;

        ALOGV("calling BT module stream stop");
        ret = a2dp.audio_stop_stream();
        if (ret < 0)
            ALOGE("stop stream to BT IPC lib failed");
        else
            ALOGV("stop steam to BT IPC lib successful");
    memset(&dummy_reset_config, 0x0, sizeof(struct sbc_enc_cfg_t));
    ctl_enc_config = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                           MIXER_ENC_CONFIG_BLOCK);
@@ -689,6 +673,29 @@ int audio_extn_a2dp_stop_playback()
        }
    }
}

int audio_extn_a2dp_stop_playback()
{
    int ret =0;

    ALOGV("audio_extn_a2dp_stop_playback start");
    if(!(a2dp.bt_lib_handle && a2dp.audio_stop_stream)) {
        ALOGE("a2dp handle is not identified, Ignoring start request");
        return -ENOSYS;
    }

    if (a2dp.a2dp_started && (a2dp.a2dp_total_active_session_request > 0))
        a2dp.a2dp_total_active_session_request--;

    if ( a2dp.a2dp_started && !a2dp.a2dp_total_active_session_request) {
        ALOGV("calling BT module stream stop");
        ret = a2dp.audio_stop_stream();
        if (ret < 0)
            ALOGE("stop stream to BT IPC lib failed");
        else
            ALOGV("stop steam to BT IPC lib successful");
        reset_a2dp_enc_config_params();
    }
    if(!a2dp.a2dp_total_active_session_request)
       a2dp.a2dp_started = false;
    ALOGD("Stop A2DP playback total active sessions :%d",
@@ -724,6 +731,7 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
         val = atoi(value);
         if (val & AUDIO_DEVICE_OUT_ALL_A2DP) {
             ALOGV("Received device dis- connect request");
             reset_a2dp_enc_config_params();
             close_a2dp_output();
         }
         goto param_handled;
@@ -735,6 +743,7 @@ void audio_extn_a2dp_set_parameters(struct str_parms *parms)
             if ((!strncmp(value,"true",sizeof(value)))) {
                ALOGD("Setting a2dp to suspend state");
                a2dp.a2dp_suspended = true;
                reset_a2dp_enc_config_params();
                if(a2dp.audio_suspend_stream)
                   a2dp.audio_suspend_stream();
            } else if (a2dp.a2dp_suspended == true) {
+9 −1
Original line number Diff line number Diff line
@@ -2452,7 +2452,15 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
                (val == AUDIO_DEVICE_NONE)) {
                val = AUDIO_DEVICE_OUT_SPEAKER;
        }

        /* To avoid a2dp to sco overlapping force route BT usecases
         * to speaker based on Phone state
         */
        if ((val & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP) &&
            ((adev->mode == AUDIO_MODE_RINGTONE) ||
            (adev->mode == AUDIO_MODE_IN_CALL))) {
            ALOGD("Forcing a2dp routing to speaker for ring/call mode");
            val = AUDIO_DEVICE_OUT_SPEAKER;
        }
        /*
         * select_devices() call below switches all the usecases on the same
         * backend to the new device. Refer to check_usecases_codec_backend() in
+1 −0
Original line number Diff line number Diff line
@@ -2924,6 +2924,7 @@ bool platform_can_split_snd_device(void *platform,
        *num_devices = 2;
        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
        status = true;
    }

    ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
+1 −1
Original line number Diff line number Diff line
@@ -2742,9 +2742,9 @@ bool platform_can_split_snd_device(void *platform,
        *num_devices = 2;
        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
        status = true;
    }


    ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
        snd_device, *num_devices, *new_snd_devices);