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

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

Merge "hal: ensure correct device selection when native playback is atvice"

parents 9c3434db 5346b4a3
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2471,6 +2471,10 @@ acdb_init_fail:
                strdup("RX_CDC_DMA_RX_0 Format");
            my_data->current_backend_cfg[HEADPHONE_BACKEND].samplerate_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 SampleRate");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 Format");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 SampleRate");

            if (default_rx_backend)
                free(default_rx_backend);
@@ -2491,6 +2495,10 @@ acdb_init_fail:
                strdup("INT0_MI2S_RX Format");
            my_data->current_backend_cfg[HEADPHONE_BACKEND].samplerate_mixer_ctl =
                strdup("INT0_MI2S_RX SampleRate");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
                strdup("INT0_MI2S_RX Format");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
                strdup("INT0_MI2S_RX SampleRate");

            if (default_rx_backend)
                free(default_rx_backend);
@@ -4025,6 +4033,9 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
        } else if (NATIVE_AUDIO_MODE_SRC == na_mode &&
                   OUTPUT_SAMPLING_RATE_44100 == sample_rate) {
                snd_device = SND_DEVICE_OUT_HEADPHONES_44_1;
        } else if (NATIVE_AUDIO_MODE_TRUE_44_1 == na_mode &&
                   OUTPUT_SAMPLING_RATE_44100 == sample_rate) {
                snd_device = SND_DEVICE_OUT_HEADPHONES_44_1;
        } else if (NATIVE_AUDIO_MODE_MULTIPLE_44_1 == na_mode &&
                   (sample_rate % OUTPUT_SAMPLING_RATE_44100 == 0) &&
                   (out->format != AUDIO_FORMAT_DSD)) {
@@ -6361,6 +6372,13 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev,

    backend_idx = platform_get_backend_index(snd_device);

    //initialize backend config if current snd_device is SND_DEVICE_NONE
    if (usecase->out_snd_device == SND_DEVICE_NONE) {
        my_data->current_backend_cfg[backend_idx].sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        my_data->current_backend_cfg[backend_idx].bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
        my_data->current_backend_cfg[backend_idx].channels = CODEC_BACKEND_DEFAULT_CHANNELS;
    }

    if (usecase->type == TRANSCODE_LOOPBACK) {
        backend_cfg.bit_width = usecase->stream.inout->out_config.bit_width;
        backend_cfg.sample_rate = usecase->stream.inout->out_config.sample_rate;