audio: fix audio glitch when closing pcm stream
Holding the audio device mutex while calling pcm_close() is not necessary
and will cause writes on other output streams to be blocked until close
completes which can take several hundred milliseconds.
Not holding the audio device mutex during the whole standby sequence
forces to change the lock order between audio device and output stream mutex.
The result is that we do not acquire the audio device mutex systematically before
the stream mutex in out_write(). This is not a problem with this audio HAL
as set_mode() does not acquire the stream mutex and out_set_parameters() is always
called in the same thread (same priority) as out_write().
Same change done for input threads.
Bug 8267567.
Change-Id: I17bb187c0564200f6362586885e61500d52d5bc2
2 files changed