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

Commit 0fc1b3b1 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by gitbuildkicker
Browse files

audio: RT streams cleanup on error

Do proper cleanup for RT streams if start fails on
these streams. Returning error from start_*_stream
does not guarantee stream will be put to standby

Bug: 30388410
Change-Id: Icbb2c6cfff95eaf4de59626b89b1c99f9090b2a3
parent 0d3637a0
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -1098,10 +1098,16 @@ int start_input_stream(struct stream_in *in)
        in->pcm = NULL;
        goto error_open;
    }
    register_in_stream(in);
    if (in->realtime) {
        ret = pcm_start(in->pcm);
        if (ret < 0) {
            ALOGE("%s: RT pcm_start failed ret %d", __func__, ret);
            pcm_close(in->pcm);
            in->pcm = NULL;
            goto error_open;
        }
    }
    register_in_stream(in);
    audio_extn_perf_lock_release();
    ALOGV("%s: exit", __func__);

@@ -1503,10 +1509,16 @@ int start_output_stream(struct stream_out *out)
            adev->offload_effects_start_output(out->handle, out->pcm_device_id);
    }
    ret = 0;
    register_out_stream(out);
    if (out->realtime) {
        ret = pcm_start(out->pcm);
        if (ret < 0) {
            ALOGE("%s: RT pcm_start failed ret %d", __func__, ret);
            pcm_close(out->pcm);
            out->pcm = NULL;
            goto error_open;
        }
    }
    register_out_stream(out);
    audio_extn_perf_lock_release();
    ALOGV("%s: exit", __func__);
    return ret;