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
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9422704..0f82a38 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3421,7 +3421,6 @@
     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 @@
         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;
+    return out_standby(&out->stream.common);
 }
 
 /*