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

Commit 28abfc17 authored by Aniket Kumar Lata's avatar Aniket Kumar Lata Committed by Gerrit - the friendly Code Review server
Browse files

hal: standby offload stream on receiving cmd error

OffloadThread invalidates tracks when it receives error notification
from async callback thread which will close current output and
reopen a new one.

If there are concurrent usecases active on the same device when the
error occurs it is possible some state maintained in the HAL won't
get reset(e.g previous sound device won't get disabled and reenabled)

Fix this by putting stream on standby and in effect disabling devices
as soon as cmd error is received instead of waiting for closeOutput
from AudioTrack to standby the stream.

CRs-Fixed: 2131661
Change-Id: I7f9d59a0a4f70f048b06553252da3ba15d7e9d79
parent 34cadac4
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -3421,7 +3421,6 @@ static int out_on_error(struct audio_stream *stream)
    struct stream_out *out = (struct stream_out *)stream;

    lock_output_stream(out);

    // always send CMD_ERROR for offload streams, this
    // is needed e.g. when SSR happens within compress_open
    // since the stream is active, offload_callback_thread is also active.
@@ -3429,18 +3428,9 @@ static int out_on_error(struct audio_stream *stream)
        stop_compressed_output_l(out);
        send_offload_cmd_l(out, OFFLOAD_CMD_ERROR);
    }

    // for compress streams , if the stream is not in standby
    // it will be triggered eventually from AF.
    bool do_standby = !out->standby &&
                      !(out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD);

    pthread_mutex_unlock(&out->lock);

    if (do_standby)
    return out_standby(&out->stream.common);

    return 0;
}

/*