From 041a7d90ddd6d4cef2d8a831e288d9ea2cea5f97 Mon Sep 17 00:00:00 2001 From: jiabin Date: Wed, 5 Jan 2022 19:06:30 +0000 Subject: [PATCH] Set standby as false when the stream is started successfully. When the audio patch is created and the stream is started, set the standby as false. In that case, if there is a simultaneous request for read or write data, it is no need to start the stream again. Bug: 212509560 Test: repo steps in the bug Change-Id: Ic3dbab3134bc761271b6b2ac8619135ef08075bc Merged-In: Ic3dbab3134bc761271b6b2ac8619135ef08075bc --- modules/usbaudio/audio_hal.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/usbaudio/audio_hal.c b/modules/usbaudio/audio_hal.c index 1bd53c27..43f8d240 100644 --- a/modules/usbaudio/audio_hal.c +++ b/modules/usbaudio/audio_hal.c @@ -1855,10 +1855,16 @@ static int adev_create_audio_patch(struct audio_hw_device *dev, if (!wasStandby) { device_lock(adev); if (in != NULL) { - start_input_stream(in); + ret = start_input_stream(in); + if (!ret) { + in->standby = false; + } } if (out != NULL) { - start_output_stream(out); + ret = start_output_stream(out); + if (!ret) { + out->standby = false; + } } device_unlock(adev); }