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

Commit f4520b0d authored by Eric Laurent's avatar Eric Laurent
Browse files

audio hal: apply app type gain after device change on VoIP use case

App type specific gain must be reapplied systemaically after a device change
otherwise it is lost.
A typical example is switching from speaker to voice-speaker on a VoIP
stream after volume was applied when the stream started.

Bug: 64972454
Test: place MO duo call and verify intial volume is correct.
Change-Id: I27cabe1690d48d34a0886d1674c7bbf2ec7099e5
parent ad2dde98
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1164,6 +1164,8 @@ int select_devices(struct audio_device *adev,
    audio_usecase_t hfp_ucid;
    struct listnode *node;
    int status = 0;
    struct audio_usecase *voip_usecase = get_usecase_from_list(adev,
                                             USECASE_AUDIO_PLAYBACK_VOIP);

    usecase = get_usecase_from_list(adev, uc_id);
    if (usecase == NULL) {
@@ -1207,8 +1209,6 @@ int select_devices(struct audio_device *adev,
            in_snd_device = SND_DEVICE_NONE;
            if (out_snd_device == SND_DEVICE_NONE) {
                struct stream_out *voip_out = adev->primary_output;
                struct audio_usecase *voip_usecase = get_usecase_from_list(adev,
                                                         USECASE_AUDIO_PLAYBACK_VOIP);

                out_snd_device = platform_get_output_snd_device(adev->platform,
                                            usecase->stream.out->devices);
@@ -1360,6 +1360,12 @@ int select_devices(struct audio_device *adev,
            voice_set_sidetone(adev, out_snd_device, true);
    }

    if (usecase == voip_usecase) {
        struct stream_out *voip_out = voip_usecase->stream.out;
        audio_extn_utils_send_app_type_gain(adev,
                                            voip_out->app_type_cfg.app_type,
                                            &voip_out->app_type_cfg.gain[0]);
    }
    return status;
}

@@ -1946,9 +1952,6 @@ int start_output_stream(struct stream_out *out)
    register_out_stream(out);
    audio_extn_perf_lock_release();
    audio_extn_tfa_98xx_enable_speaker();
    audio_extn_utils_send_app_type_gain(out->dev,
                                        out->app_type_cfg.app_type,
                                        &out->app_type_cfg.gain[0]);

    // consider a scenario where on pause lower layers are tear down.
    // so on resume, swap mixer control need to be sent only when