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

Commit 8b0868f1 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: re-route VOIP TX path for enabling correct VOIP EC port"

parents feeb1163 8ae5489b
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
 * Not a Contribution.
 *
 * Copyright (C) 2013 The Android Open Source Project
@@ -2983,6 +2983,30 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
    }
    enable_audio_route(adev, usecase);

    if (uc_id == USECASE_AUDIO_PLAYBACK_VOIP) {
        struct stream_in *voip_in = get_voice_communication_input(adev);
        struct audio_usecase *voip_in_usecase = NULL;
        voip_in_usecase = get_usecase_from_list(adev, USECASE_AUDIO_RECORD_VOIP);
        if (voip_in != NULL &&
            voip_in_usecase != NULL &&
            !(out_snd_device == AUDIO_DEVICE_OUT_SPEAKER ||
              out_snd_device == AUDIO_DEVICE_OUT_SPEAKER_SAFE) &&
            (voip_in_usecase->in_snd_device ==
            platform_get_input_snd_device(adev->platform, voip_in,
                    &usecase->stream.out->device_list,usecase->type))) {
            /*
             * if VOIP TX is enabled before VOIP RX, needs to re-route the TX path
             * for enabling echo-reference-voip with correct port
             */
            ALOGD("%s: VOIP TX is enabled before VOIP RX,needs to re-route the TX path",__func__);
            disable_audio_route(adev, voip_in_usecase);
            disable_snd_device(adev, voip_in_usecase->in_snd_device);
            enable_snd_device(adev, voip_in_usecase->in_snd_device);
            enable_audio_route(adev, voip_in_usecase);
        }
    }


    audio_extn_qdsp_set_device(usecase);

    /* If input stream is already running then effect needs to be