summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/audio_hw.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 5e36799..24f507f 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -1505,8 +1505,13 @@ static int start_output_stream_deep_buffer(struct tuna_stream_out *out)
select_output_device(adev);
}
- out->write_threshold = PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT * DEEP_BUFFER_LONG_PERIOD_SIZE;
- out->use_long_periods = true;
+ out->use_long_periods = adev->screen_off && !adev->active_input;
+ /* TODO: Do we need a pcm_set_avail_min here somehow? */
+ if (out->use_long_periods) {
+ out->write_threshold = PLAYBACK_DEEP_BUFFER_LONG_PERIOD_COUNT * DEEP_BUFFER_LONG_PERIOD_SIZE;
+ } else {
+ out->write_threshold = PLAYBACK_DEEP_BUFFER_SHORT_PERIOD_COUNT * DEEP_BUFFER_SHORT_PERIOD_SIZE;
+ }
out->config[PCM_NORMAL] = pcm_config_mm;
#ifndef USE_VARIABLE_SAMPLING_RATE