[pulseaudio-commits] r2270 - /branches/glitch-free/src/utils/pacat.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sun Apr 20 12:38:33 PDT 2008


Author: lennart
Date: Sun Apr 20 21:38:33 2008
New Revision: 2270

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2270&root=pulseaudio&view=rev
Log:
print a message on xrun

Modified:
    branches/glitch-free/src/utils/pacat.c

Modified: branches/glitch-free/src/utils/pacat.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/utils/pacat.c?rev=2270&root=pulseaudio&r1=2269&r2=2270&view=diff
==============================================================================
--- branches/glitch-free/src/utils/pacat.c (original)
+++ branches/glitch-free/src/utils/pacat.c Sun Apr 20 21:38:33 2008
@@ -212,6 +212,18 @@
     }
 }
 
+static void stream_underflow_callback(pa_stream *s, void *userdata) {
+    assert(s);
+
+    fprintf(stderr, "Underrun.\n");
+}
+
+static void stream_overflow_callback(pa_stream *s, void *userdata) {
+    assert(s);
+
+    fprintf(stderr, "Overrun.\n");
+}
+
 static void stream_moved_callback(pa_stream *s, void *userdata) {
     assert(s);
 
@@ -249,6 +261,8 @@
             pa_stream_set_read_callback(stream, stream_read_callback, NULL);
             pa_stream_set_suspended_callback(stream, stream_suspended_callback, NULL);
             pa_stream_set_moved_callback(stream, stream_moved_callback, NULL);
+            pa_stream_set_underflow_callback(stream, stream_underflow_callback, NULL);
+            pa_stream_set_overflow_callback(stream, stream_overflow_callback, NULL);
 
             if (latency > 0) {
                 memset(&buffer_attr, 0, sizeof(buffer_attr));
@@ -416,14 +430,14 @@
 
 /* Show the current latency */
 static void stream_update_timing_callback(pa_stream *s, int success, void *userdata) {
-    pa_usec_t latency, usec;
+    pa_usec_t l, usec;
     int negative = 0;
 
     assert(s);
 
     if (!success ||
         pa_stream_get_time(s, &usec) < 0 ||
-        pa_stream_get_latency(s, &latency, &negative) < 0) {
+        pa_stream_get_latency(s, &l, &negative) < 0) {
         fprintf(stderr, "Failed to get latency: %s\n", pa_strerror(pa_context_errno(context)));
         quit(1);
         return;
@@ -431,7 +445,7 @@
 
     fprintf(stderr, "Time: %0.3f sec; Latency: %0.0f usec.  \r",
             (float) usec / 1000000,
-            (float) latency * (negative?-1:1));
+            (float) l * (negative?-1:1));
 }
 
 /* Someone requested that the latency is shown */




More information about the pulseaudio-commits mailing list