[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, stable-queue, updated. v0.9.21-42-g19fa81b

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Feb 17 16:56:45 PST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The stable-queue branch has been updated
      from  5e2af2d3f3dea473d46b33a5e90a993ac5da3f35 (commit)

- Log -----------------------------------------------------------------
19fa81b pacat: always fully fulfill write requests
-----------------------------------------------------------------------

Summary of changes:
 src/utils/pacat.c |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

-----------------------------------------------------------------------

commit 19fa81bf1375032cb1a27c7715a28a52b238d4cb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Feb 18 01:54:51 2010 +0100

    pacat: always fully fulfill write requests
    
    Make sure we always fulfill write requests from the server. If we don't
    the server won't ask us again and playback will stay stuck.
    
    https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-February/006611.html

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index a5d2e9a..d136f6b 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -195,28 +195,41 @@ static void stream_write_callback(pa_stream *s, size_t length, void *userdata) {
 
         pa_assert(sndfile);
 
-        if (pa_stream_begin_write(s, &data, &length) < 0) {
-            pa_log(_("pa_stream_begin_write() failed: %s"), pa_strerror(pa_context_errno(context)));
-            quit(1);
-            return;
-        }
+        for (;;) {
+            size_t data_length = length;
 
-        if (readf_function) {
-            size_t k = pa_frame_size(&sample_spec);
+            if (pa_stream_begin_write(s, &data, &data_length) < 0) {
+                pa_log(_("pa_stream_begin_write() failed: %s"), pa_strerror(pa_context_errno(context)));
+                quit(1);
+                return;
+            }
 
-            if ((bytes = readf_function(sndfile, data, (sf_count_t) (length/k))) > 0)
-                bytes *= (sf_count_t) k;
+            if (readf_function) {
+                size_t k = pa_frame_size(&sample_spec);
 
-        } else
-            bytes = sf_read_raw(sndfile, data, (sf_count_t) length);
+                if ((bytes = readf_function(sndfile, data, (sf_count_t) (data_length/k))) > 0)
+                    bytes *= (sf_count_t) k;
 
-        if (bytes > 0)
-            pa_stream_write(s, data, (size_t) bytes, NULL, 0, PA_SEEK_RELATIVE);
-        else
-            pa_stream_cancel_write(s);
+            } else
+                bytes = sf_read_raw(sndfile, data, (sf_count_t) data_length);
 
-        if (bytes < (sf_count_t) length)
-            start_drain();
+            if (bytes > 0)
+                pa_stream_write(s, data, (size_t) bytes, NULL, 0, PA_SEEK_RELATIVE);
+            else
+                pa_stream_cancel_write(s);
+
+            /* EOF? */
+            if (bytes < (sf_count_t) data_length) {
+                start_drain();
+                break;
+            }
+
+            /* Request fulfilled */
+            if ((size_t) bytes >= length)
+                break;
+
+            length -= bytes;
+        }
     }
 }
 

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list