diff options
author | Maneet Singh <mmaneetsingh@nvidia.com> | 2015-06-11 17:43:01 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2015-06-22 10:40:13 -0700 |
commit | 0094c53eba6ae36486136417def4335fe7903c71 (patch) | |
tree | 68064e967a68a22783ccd610563c3badd7ee492d | |
parent | 7458cfd9aa34aa18b84a0a76141ff98cad8f92c3 (diff) | |
download | flounder-0094c53eba6ae36486136417def4335fe7903c71.tar.gz |
audio: handle audio underruns using silence playback
Audio underruns can be handled either by stopping pcm device and
preparing it again or by playing silence frames till application
fills the buffer again. On average, stopping and preparing pcm device
takes 2-4 times more time than just playing silence frames and let
the application catch-up. So switching to that approach now.
Bug: 20226809
Bug: 20300203
Change-Id: I53a1d32879e594d15fa2b0142852649edb2b5835
-rw-r--r-- | audio/hal/audio_hw.c | 1 | ||||
-rw-r--r-- | audio/hal/audio_hw.h | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/audio/hal/audio_hw.c b/audio/hal/audio_hw.c index 2d70a13..07fe9bb 100644 --- a/audio/hal/audio_hw.c +++ b/audio/hal/audio_hw.c @@ -61,6 +61,7 @@ static struct pcm_device_profile pcm_device_playback = { .start_threshold = PLAYBACK_START_THRESHOLD, .stop_threshold = PLAYBACK_STOP_THRESHOLD, .silence_threshold = 0, + .silence_size = UINT_MAX, .avail_min = PLAYBACK_AVAILABLE_MIN, }, .card = SOUND_CARD, diff --git a/audio/hal/audio_hw.h b/audio/hal/audio_hw.h index 68040ec..96e84c8 100644 --- a/audio/hal/audio_hw.h +++ b/audio/hal/audio_hw.h @@ -137,7 +137,7 @@ enum { #define PLAYBACK_DEFAULT_CHANNEL_COUNT 2 #define PLAYBACK_DEFAULT_SAMPLING_RATE 48000 #define PLAYBACK_START_THRESHOLD ((PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT) - 1) -#define PLAYBACK_STOP_THRESHOLD (PLAYBACK_PERIOD_SIZE * PLAYBACK_PERIOD_COUNT) +#define PLAYBACK_STOP_THRESHOLD (PLAYBACK_PERIOD_SIZE * (PLAYBACK_PERIOD_COUNT + 2)) #define PLAYBACK_AVAILABLE_MIN 1 |