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

Commit ff56ff35 authored by Weiyin Jiang's avatar Weiyin Jiang
Browse files

hal: add usecase type check

Add usecase type check to avoid crash.

CRs-Fixed: 2681468
Change-Id: I4927d4ff54350a88cfa0c17255331797230387a2
parent 40f2b321
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -8751,8 +8751,10 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
        struct listnode *node;
        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);
            if (usecase->stream.out && (usecase->type == PCM_PLAYBACK) &&
                is_a2dp_out_device_type(&usecase->device_list)) {
            if ((usecase->stream.out == NULL) || (usecase->type != PCM_PLAYBACK))
                continue;

            if (is_a2dp_out_device_type(&usecase->device_list)) {
                ALOGD("reconfigure a2dp... forcing device switch");
                pthread_mutex_unlock(&adev->lock);
                lock_output_stream(usecase->stream.out);