audio: log error before closing stream
Bug: 31591209
Change-Id: Ie84ac5dad3e1f0987d359d60b5a33bc86ffa4e34
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e68535f..2d50698 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2076,9 +2076,9 @@
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
- out_on_error(&out->stream.common);
if (out->pcm)
ALOGE("%s: error %zu - %s", __func__, ret, pcm_get_error(out->pcm));
+ out_on_error(&out->stream.common);
if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD)
usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate(&out->stream.common));