From 09ce7fbfffbe20b69960715ec659b40628611caa Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 19 Jun 2015 14:29:15 -0700 Subject: 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 --- audio/hal/audio_hw.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'audio/hal/audio_hw.h') 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; -- cgit v1.2.3