summaryrefslogtreecommitdiff
path: root/audio/hal/audio_hw.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-06-19 14:29:15 -0700
committerEric Laurent <elaurent@google.com>2015-06-19 14:29:15 -0700
commit09ce7fbfffbe20b69960715ec659b40628611caa (patch)
treef6aee47e5b59e9176bb762487a7e2abc5d0d7ad3 /audio/hal/audio_hw.h
parent282d8411892de038d525ff8278d1890ae2387219 (diff)
downloadflounder-09ce7fbfffbe20b69960715ec659b40628611caa.tar.gz
audio HAL: fix thread starvation
Fix thread starvation issue where the capture or playback threads running in FIFO priority would constantly acquire the stream mutex preventing other threads to complete routing commands. Bug: 21880828. Change-Id: I36e9c609857dd1bc959809326350a04c3af92228
Diffstat (limited to 'audio/hal/audio_hw.h')
-rw-r--r--audio/hal/audio_hw.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/audio/hal/audio_hw.h b/audio/hal/audio_hw.h
index 8563d84..68040ec 100644
--- a/audio/hal/audio_hw.h
+++ b/audio/hal/audio_hw.h
@@ -264,6 +264,7 @@ struct pcm_device {
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 listnode pcm_dev_list;
@@ -310,6 +311,8 @@ struct stream_out {
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 listnode pcm_dev_list;
int standby;