hal: Fix compressed offload SSR resume
Change sequence order in out_on_error so that the
stream is put into out standby before the offload
error callback is sent. This ensures that the
offload thread isn't blocked by out_standby handling.
Change-Id: Ibd1b73c7a995681b1d1ae4e79cef49d7cc658bb8
CRs-Fixed: 2297495
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index fbb590d..1236964 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3542,6 +3542,7 @@
static int out_on_error(struct audio_stream *stream)
{
struct stream_out *out = (struct stream_out *)stream;
+ int status = 0;
lock_output_stream(out);
// always send CMD_ERROR for offload streams, this
@@ -3549,11 +3550,18 @@
// since the stream is active, offload_callback_thread is also active.
if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
stop_compressed_output_l(out);
+ }
+ pthread_mutex_unlock(&out->lock);
+
+ status = out_standby(&out->stream.common);
+
+ lock_output_stream(out);
+ if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
send_offload_cmd_l(out, OFFLOAD_CMD_ERROR);
}
pthread_mutex_unlock(&out->lock);
- return out_standby(&out->stream.common);
+ return status;
}
/*