summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorKyle Repinski <repinski23@gmail.com>2015-03-24 22:57:56 -0500
committerZiyan <jaraidaniel@gmail.com>2016-01-15 12:30:40 +0100
commit288e217279919b64677c5b2d6c5d5e23bca67d3b (patch)
treed74344df3f4be80fa15f2cf9b270c4f56be35d23 /audio
parente83f84c19d5e54ce4569e917afc19e35326b9041 (diff)
downloaddevice_samsung_tuna-288e217279919b64677c5b2d6c5d5e23bca67d3b.zip
device_samsung_tuna-288e217279919b64677c5b2d6c5d5e23bca67d3b.tar.gz
device_samsung_tuna-288e217279919b64677c5b2d6c5d5e23bca67d3b.tar.bz2
audio: Fix buffer underrun doing short to long period transition.
This basically halves the long period size. I wish there was a different way to fix this but I don't think there is.
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index dae9d8a..eaf09a0 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -161,8 +161,10 @@
((DEEP_BUFFER_SHORT_PERIOD_SIZE * PLAYBACK_DEEP_BUFFER_SHORT_PERIOD_COUNT) / 2)
/* number of short deep buffer periods in a long period */
-#define DEEP_BUFFER_LONG_PERIOD_MULTIPLIER \
- (DEEP_BUFFER_LONG_PERIOD_MS / DEEP_BUFFER_SHORT_PERIOD_MS)
+/* previously, this was (DEEP_BUFFER_LONG_PERIOD_MS / DEEP_BUFFER_SHORT_PERIOD_MS), but that caused a buffer underrun
+ * during the transition from short to long periods. A MULTIPLIER_FACTOR of 7 is the sweet-spot to stop those underruns. */
+#define DEEP_BUFFER_LONG_PERIOD_MULTIPLIER 7
+
/* number of frames per long deep buffer period (screen off) */
#define DEEP_BUFFER_LONG_PERIOD_SIZE \
(DEEP_BUFFER_SHORT_PERIOD_SIZE * DEEP_BUFFER_LONG_PERIOD_MULTIPLIER)