chiark / gitweb /
Use snd_pcm_prepare() instead of snd_pcm_recover(), since the latter
authorRichard Kettlewell <richard@dekabrach>
Tue, 25 Mar 2008 19:41:52 +0000 (19:41 +0000)
committerRichard Kettlewell <richard@dekabrach>
Tue, 25 Mar 2008 19:41:52 +0000 (19:41 +0000)
isn't available in older ALSAs.

lib/alsabg.c
lib/alsabg.h

index 61648f4af0a2d4ac2602a0f078af87b474d16dd4..be589ce9e3be659d1660d1a2a6e885061a418b53 100644 (file)
@@ -179,12 +179,14 @@ static void *alsa_bg_play(void attribute((unused)) *arg) {
     rframes = snd_pcm_writei(pcm, alsa_bg_buffer + start, nframes);
     ep(pthread_mutex_lock(&alsa_bg_lock));
     if(rframes < 0) {
-      error(0, "snd_pcm_writei: %d", rframes);
       switch(rframes) {
       case -EPIPE:
-        if((err = snd_pcm_recover(pcm, -EPIPE, 0)))
-          fatal(0, "snd_pcm_recover: %d", err);
+        error(0, "underrun detected");
+        if((err = snd_pcm_prepare(pcm)))
+          fatal(0, "snd_pcm_prepare: %d", err);
         break;
+      default:
+        fatal(0, "snd_pcm_writei: %d", rframes);
       }
     } else {
       const int rbytes = rframes * BYTES_PER_FRAME;
index 0ef9c59f75d79151fea94627374426739db8b47a..57fb64dbe56a05cd5ef524c2999bd22b813ffe83 100644 (file)
@@ -37,9 +37,9 @@
  * occurred.  It will be called in a background thread.
  */
 typedef int alsa_bg_supply(void *dst,
-                          unsigned nsamples);
+                          unsigned nsamples_max);
 
-void alsa_bg_init(const char *device,
+void alsa_bg_init(const char *dev,
                  alsa_bg_supply *supply);
 
 void alsa_bg_enable(void);