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

Commit a72c94a9 authored by Ashish Jain's avatar Ashish Jain
Browse files

hal: Ensure during voice call backend in sample rate is fixed at 48kHz

-True native playback uses same backend to play 44.1kHz as well as
48kHz.
-During voice call if backend gets reconfigured to sample rate of
44.1kHz then voice call fails.
-Hence ensure that if voice call is active the backend irrespective
of native playback is fixed at sample rate of 48Khz.

Change-Id: I610d701bd89ae25acdd8cea63d03d77e9f791af6
parent a9b9d18d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -5184,6 +5184,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
    unsigned int sample_rate;
    unsigned int channels;
    bool passthrough_enabled = false;
    bool voice_call_active = false;
    int backend_idx = DEFAULT_CODEC_BACKEND;
    struct platform_data *my_data = (struct platform_data *)adev->platform;
    int na_mode = platform_get_native_support();
@@ -5216,6 +5217,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
        bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
        sample_rate =  CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        channels = CODEC_BACKEND_DEFAULT_CHANNELS;
        voice_call_active = true;
    } else {
        /*
         * The backend should be configured at highest bit width and/or
@@ -5255,7 +5257,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
    }

    /* Native playback is preferred for Headphone/HS device over 192Khz */
    if (codec_device_supports_native_playback(usecase->devices)) {
    if (!voice_call_active && codec_device_supports_native_playback(usecase->devices)) {
        if (audio_is_true_native_stream_active(adev)) {
            if (check_hdset_combo_device(snd_device)) {
                /*
@@ -5266,8 +5268,8 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                 */
                    sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
                    bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
                    ALOGD("%s:becf: afe: port has to run at 48k for a combo device",
                          __func__);
                    ALOGD("%s:becf: afe: port to run at 48k if combo device or in voice call"
                           , __func__);
            } else {
             /*
              * in single BE mode, if native audio playback
+5 −3
Original line number Diff line number Diff line
@@ -5067,6 +5067,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
    unsigned int sample_rate;
    unsigned int channels;
    bool passthrough_enabled = false;
    bool voice_call_active = false;
    int backend_idx = DEFAULT_CODEC_BACKEND;
    struct platform_data *my_data = (struct platform_data *)adev->platform;
    int na_mode = platform_get_native_support();
@@ -5100,6 +5101,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
        bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
        sample_rate =  CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        channels = CODEC_BACKEND_DEFAULT_CHANNELS;
        voice_call_active = true;
    } else {
        /*
         * The backend should be configured at highest bit width and/or
@@ -5139,7 +5141,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
    }

    /* Native playback is preferred for Headphone/HS device over 192Khz */
    if (codec_device_supports_native_playback(usecase->devices)) {
    if (!voice_call_active && codec_device_supports_native_playback(usecase->devices)) {
        if (audio_is_true_native_stream_active(adev)) {
            if (check_hdset_combo_device(snd_device)) {
                /*
@@ -5150,8 +5152,8 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                 */
                    sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
                    bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
                    ALOGD("%s:becf: afe: port has to run at 48k for a combo device",
                          __func__);
                    ALOGD("%s:becf: afe: port to run at 48k if combo device or in voice call"
                           , __func__);
            } else {
             /*
              * in single BE mode, if native audio playback