Update of /cvsroot/alsa/alsa-utils/aplay
In directory sc8-pr-cvs1:/tmp/cvs-serv27224

Modified Files:
        aplay.c 
Log Message:
Added handling of DRAINING state and extended verbose parts

Index: aplay.c
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/aplay/aplay.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -r1.167 -r1.168
--- aplay.c     29 Jul 2003 14:33:47 -0000      1.167
+++ aplay.c     30 Jul 2003 17:54:42 -0000      1.168
@@ -937,7 +937,9 @@
                gettimeofday(&now, 0);
                snd_pcm_status_get_trigger_tstamp(status, &tstamp);
                timersub(&now, &tstamp, &diff);
-               fprintf(stderr, "xrun!!! (at least %.3f ms long)\n", diff.tv_sec * 
1000 + diff.tv_usec / 1000.0);
+               fprintf(stderr, "%s!!! (at least %.3f ms long)\n",
+                       stream == SND_PCM_STREAM_PLAYBACK ? "underrun" : "overrun",
+                       diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
                if (verbose) {
                        fprintf(stderr, "Status:\n");
                        snd_pcm_status_dump(status, log);
@@ -947,6 +949,23 @@
                        exit(EXIT_FAILURE);
                }
                return;         /* ok, data should be accepted again */
+       } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
+               if (verbose) {
+                       fprintf(stderr, "Status(DRAINING):\n");
+                       snd_pcm_status_dump(status, log);
+               }
+               if (stream == SND_PCM_STREAM_CAPTURE) {
+                       fprintf(stderr, "capture stream format change? attempting 
recover...\n");
+                       if ((res = snd_pcm_prepare(handle))<0) {
+                               error("xrun(DRAINING): prepare error: %s", 
snd_strerror(res));
+                               exit(EXIT_FAILURE);
+                       }
+                       return;
+               }
+       }
+       if (verbose) {
+               fprintf(stderr, "Status(R/W):\n");
+               snd_pcm_status_dump(status, log);
        }
        error("read/write error, state = %s", 
snd_pcm_state_name(snd_pcm_status_get_state(status)));
        exit(EXIT_FAILURE);



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to