summaryrefslogtreecommitdiff
path: root/plugins/alsa
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-23 14:56:50 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-01-23 14:56:50 +0100
commit9be49f3f078dbe9668c8c40b7171a0d039f19682 (patch)
tree84332045845d85addef9577c712a2cf4167e8e46 /plugins/alsa
parent6ef6490c3136141b346596d2aad81b9cb5d478e9 (diff)
alsa buffer tweaks
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 6c806f51..c035adcb 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -29,6 +29,9 @@
static DB_output_t plugin;
DB_functions_t *deadbeef;
+#define BUFFER_MIN 1024
+#define BUFFER_MAX 4096
+
static snd_pcm_t *audio;
static int bufsize = -1;
static int alsa_terminate;
@@ -473,13 +476,13 @@ palsa_thread (void *context) {
/* deliver the data */
// FIXME: under some conditions, frames_to_deliver may become huge
// like 20M. this case is not handled here.
- if (frames_to_deliver < 1024) {
- trace ("alsa: frames_to_deliver clipped from %d to 1024\n", frames_to_deliver);
- frames_to_deliver = 1024;
+ if (frames_to_deliver < BUFFER_MIN) {
+ trace ("alsa: frames_to_deliver clipped from %d to %d\n", frames_to_deliver, BUFFER_MIN);
+ frames_to_deliver = BUFFER_MIN;
}
- else if (frames_to_deliver > 2048) {
- trace ("alsa: frames_to_deliver clipped from %d to 2048\n", frames_to_deliver);
- frames_to_deliver = 2048;
+ else if (frames_to_deliver > BUFFER_MAX) {
+ trace ("alsa: frames_to_deliver clipped from %d to %d\n", frames_to_deliver, BUFFER_MAX);
+ frames_to_deliver = BUFFER_MAX;
}
char buf[frames_to_deliver*4];
palsa_callback (buf, frames_to_deliver*4);