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

Commit 815b43e2 authored by kunleiz's avatar kunleiz Committed by Gerrit - the friendly Code Review server
Browse files

hal: reset backend sample rate if device backend is not supported

During playback, output stream sample rate mismatches with device
backend supported sample rate. And the backend sample rate is still
set to stream sample rate. This causes mute issue happens.

Fix it by resetting backend sample rate at default sample rate if
backend supported sample rate and stream sample rate are mismatched.

CRs-Fixed: 2293122
Change-Id: I72da6ff176d0558cb7635a265d5fde5a9ea3942a
parent 1585f848
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -6144,10 +6144,11 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
            ALOGD("%s:becf: afe: napb not active - set non fractional rate",
                       __func__);
        }
        /*ensure AFE set to 48khz when sample rate less than 44.1khz*/
        if (sample_rate < OUTPUT_SAMPLING_RATE_44100) {
        /*reset sample rate to 48khz if sample rate less than 44.1khz, or device backend dose not support 44.1 khz*/
        if ((sample_rate == OUTPUT_SAMPLING_RATE_44100 && backend_idx != HEADPHONE_44_1_BACKEND)
            || sample_rate < OUTPUT_SAMPLING_RATE_44100) {
                sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
            ALOGD("%s:becf: afe: napb set sample rate to default Sample Rate(48k)",__func__);
            ALOGD("%s:becf: afe: reset sample rate to default Sample Rate(48k)",__func__);
        }
    }