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

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

Merge "hal: Fix for a native crash in select_devices"

parents b54d1c00 bdda2f21
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1334,6 +1334,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
    if ((usecase->type == VOICE_CALL) ||
        (usecase->type == VOIP_CALL)  ||
        (usecase->type == PCM_HFP_CALL)) {
        if(usecase->stream.out == NULL) {
            ALOGE("%s: stream.out is NULL", __func__);
            return -EINVAL;
        }
        out_snd_device = platform_get_output_snd_device(adev->platform,
                                                        usecase->stream.out);
        in_snd_device = platform_get_input_snd_device(adev->platform, usecase->stream.out->devices);
@@ -1377,6 +1381,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
            }
        }
        if (usecase->type == PCM_PLAYBACK) {
            if (usecase->stream.out == NULL) {
                ALOGE("%s: stream.out is NULL", __func__);
                return -EINVAL;
            }
            usecase->devices = usecase->stream.out->devices;
            in_snd_device = SND_DEVICE_NONE;
            if (out_snd_device == SND_DEVICE_NONE) {
@@ -1389,6 +1397,10 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
                }
            }
        } else if (usecase->type == PCM_CAPTURE) {
            if (usecase->stream.in == NULL) {
                ALOGE("%s: stream.in is NULL", __func__);
                return -EINVAL;
            }
            usecase->devices = usecase->stream.in->device;
            out_snd_device = SND_DEVICE_NONE;
            if (in_snd_device == SND_DEVICE_NONE) {