Revert "Revert "audio HAL: fix thread starvation""
This reverts commit 6010f700e24e5cf4352043febaa8342c099cc3b8.
Bug: 21880828
Change-Id: I722fb8619b4286f50215fcd198526ca5fce64d03
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 39e5263..b82ee8b 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -125,6 +125,7 @@
struct stream_out {
struct audio_stream_out stream;
pthread_mutex_t lock; /* see note below on mutex acquisition order */
+ pthread_mutex_t pre_lock; /* acquire before lock to avoid DOS by playback thread */
pthread_cond_t cond;
struct pcm_config config;
struct compr_config compr_config;
@@ -163,6 +164,7 @@
struct stream_in {
struct audio_stream_in stream;
pthread_mutex_t lock; /* see note below on mutex acquisition order */
+ pthread_mutex_t pre_lock; /* acquire before lock to avoid DOS by capture thread */
struct pcm_config config;
struct pcm *pcm;
int standby;