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

Commit dc4f757f authored by Krishnankutty Kolathappilly's avatar Krishnankutty Kolathappilly Committed by Gerrit - the friendly Code Review server
Browse files

hal : Fix for stability offload issues.

-Disable and enable the device seperately from
 check_usecases_codec_backend function.
-Acquire device lock for pcm close. This prevents crash during
 headset device switch and fast forward.
-hw free is getting called from compress framework while runtime
 update is going on. The front end list could be cleared during
 runtime update and concurrent access of front end list could
 result a crash.

CRs-Fixed: 568710
Change-Id: Iccc2b9d3c175a5421cfc4d070b0af3906d9080c5
parent ac203d58
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -358,10 +358,15 @@ static void check_usecases_codec_backend(struct audio_device *adev,
            usecase = node_to_item(node, struct audio_usecase, list);
            if (switch_device[usecase->id]) {
                disable_snd_device(adev, usecase->out_snd_device, false);
                enable_snd_device(adev, snd_device, false);
            }
        }

        list_for_each(node, &adev->usecase_list) {
            usecase = node_to_item(node, struct audio_usecase, list);
            if (switch_device[usecase->id]) {
                enable_snd_device(adev, snd_device, false);
            }
        }
        /* Make sure new snd device is enabled before re-routing the streams */
        audio_route_update_mixer(adev->audio_route);

@@ -1198,6 +1203,7 @@ static int out_standby(struct audio_stream *stream)
          out->usecase, use_case_table[out->usecase]);

    pthread_mutex_lock(&out->lock);
    pthread_mutex_lock(&adev->lock);
    if (!out->standby) {
        out->standby = true;
        if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
@@ -1214,10 +1220,9 @@ static int out_standby(struct audio_stream *stream)
                out->compr = NULL;
            }
        }
        pthread_mutex_lock(&adev->lock);
        stop_output_stream(out);
        pthread_mutex_unlock(&adev->lock);
    }
    pthread_mutex_unlock(&adev->lock);
    pthread_mutex_unlock(&out->lock);
    ALOGV("%s: exit", __func__);
    return 0;