]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - alsa_write.c
alsa: Do not buffer more than 500ms.
[paraslash.git] / alsa_write.c
index e741578c66378d74926c28bea86a56c084bde255..a211985ab94bb71406d7729793387bbabc5fc452 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -16,7 +16,6 @@
 #include <sys/types.h>
 #include <alsa/asoundlib.h>
 #include <sys/time.h>
-#include <stdbool.h>
 
 #include "para.h"
 #include "fd.h"
@@ -114,6 +113,8 @@ static int alsa_init(struct private_alsa_write_data *pad,
                NULL);
        if (ret < 0 || buffer_time == 0)
                goto fail;
+       /* buffer at most 500 milliseconds */
+       buffer_time = PARA_MIN(buffer_time, 500U * 1000U);
        msg = "could not set buffer time";
        ret = snd_pcm_hw_params_set_buffer_time_near(pad->handle, hwparams,
                &buffer_time, NULL);