[xiph-commits] r7715 - icecast/trunk/ices/src

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Tue Sep 7 09:55:33 PDT 2004


Author: karl
Date: 2004-09-07 09:55:32 -0700 (Tue, 07 Sep 2004)
New Revision: 7715

Modified:
   icecast/trunk/ices/src/im_alsa.c
   icecast/trunk/ices/src/im_alsa.h
Log:
make setting the periods in alsa optional, virtual devices like those using
dsnoop could make ices fail unnecessarily.


Modified: icecast/trunk/ices/src/im_alsa.c
===================================================================
--- icecast/trunk/ices/src/im_alsa.c	2004-09-07 00:55:05 UTC (rev 7714)
+++ icecast/trunk/ices/src/im_alsa.c	2004-09-07 16:55:32 UTC (rev 7715)
@@ -180,7 +180,7 @@
     s->rate = 44100; /* Defaults */
     s->channels = 2; 
     s->buffer_time = 500000;
-    s->periods = 2;
+    s->periods = -1;
 
     thread_mutex_create(&s->metadatalock);
 
@@ -254,10 +254,14 @@
         LOG_ERROR2("Error setting buffer time %u: %s", s->buffer_time, snd_strerror(err));
         goto fail;
     }
-    if ((err = snd_pcm_hw_params_set_periods(s->fd, hwparams, s->periods, 0)) < 0)
+    if (s->periods > 0)
     {
-        LOG_ERROR2("Error setting %u periods: %s", s->periods, snd_strerror(err));
-        goto fail;
+        err = snd_pcm_hw_params_set_periods(s->fd, hwparams, s->periods, 0);
+        if (err < 0)
+        {
+            LOG_ERROR2("Error setting %u periods: %s", s->periods, snd_strerror(err));
+            goto fail;
+        }
     }
     if ((err = snd_pcm_hw_params(s->fd, hwparams)) < 0)
     {
@@ -267,8 +271,8 @@
 
     /* We're done, and we didn't fail! */
     LOG_INFO1 ("Opened audio device %s", device);
-    LOG_INFO4 ("using %d channel(s), %d Hz, buffer %u ms (%u periods)",
-            s->channels, s->rate, s->buffer_time/1000, s->periods);
+    LOG_INFO3 ("using %d channel(s), %d Hz, buffer %u ms ",
+            s->channels, s->rate, s->buffer_time/1000);
 
     if(use_metadata)
     {

Modified: icecast/trunk/ices/src/im_alsa.h
===================================================================
--- icecast/trunk/ices/src/im_alsa.h	2004-09-07 00:55:05 UTC (rev 7714)
+++ icecast/trunk/ices/src/im_alsa.h	2004-09-07 16:55:32 UTC (rev 7715)
@@ -26,7 +26,7 @@
     unsigned int rate;
     int channels;
     unsigned buffer_time;
-    unsigned periods;
+    int periods;
 
     snd_pcm_t *fd;
     char **metadata;



More information about the commits mailing list