[pulseaudio-commits] r2490 - in /trunk/src: modules/module-ladspa-sink.c pulsecore/play-memblockq.c pulsecore/protocol-simple.c pulsecore/sound-file-stream.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue May 27 15:08:43 PDT 2008


Author: lennart
Date: Wed May 28 00:08:42 2008
New Revision: 2490

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2490&root=pulseaudio&view=rev
Log:
never hand out more data from a sink input than requested. Otherwise the resampler might run for too long and we get a heavy delay/underrun

Modified:
    trunk/src/modules/module-ladspa-sink.c
    trunk/src/pulsecore/play-memblockq.c
    trunk/src/pulsecore/protocol-simple.c
    trunk/src/pulsecore/sound-file-stream.c

Modified: trunk/src/modules/module-ladspa-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-ladspa-sink.c?rev=2490&root=pulseaudio&r1=2489&r2=2490&view=diff
==============================================================================
--- trunk/src/modules/module-ladspa-sink.c (original)
+++ trunk/src/modules/module-ladspa-sink.c Wed May 28 00:08:42 2008
@@ -185,6 +185,7 @@
         pa_memblock_unref(nchunk.memblock);
     }
 
+    tchunk.length = PA_MIN(nbytes, tchunk.length);
     pa_assert(tchunk.length > 0);
 
     fs = pa_frame_size(&i->sample_spec);

Modified: trunk/src/pulsecore/play-memblockq.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/play-memblockq.c?rev=2490&root=pulseaudio&r1=2489&r2=2490&view=diff
==============================================================================
--- trunk/src/pulsecore/play-memblockq.c (original)
+++ trunk/src/pulsecore/play-memblockq.c Wed May 28 00:08:42 2008
@@ -138,6 +138,7 @@
         return -1;
     }
 
+    chunk->length = PA_MIN(chunk->length, nbytes);
     pa_memblockq_drop(u->memblockq, chunk->length);
 
     return 0;

Modified: trunk/src/pulsecore/protocol-simple.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/protocol-simple.c?rev=2490&root=pulseaudio&r1=2489&r2=2490&view=diff
==============================================================================
--- trunk/src/pulsecore/protocol-simple.c (original)
+++ trunk/src/pulsecore/protocol-simple.c Wed May 28 00:08:42 2008
@@ -373,6 +373,8 @@
         return -1;
     } else {
         size_t m;
+
+        chunk->length = PA_MIN(length, chunk->length);
 
         c->playback.underrun = FALSE;
 

Modified: trunk/src/pulsecore/sound-file-stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sound-file-stream.c?rev=2490&root=pulseaudio&r1=2489&r2=2490&view=diff
==============================================================================
--- trunk/src/pulsecore/sound-file-stream.c (original)
+++ trunk/src/pulsecore/sound-file-stream.c Wed May 28 00:08:42 2008
@@ -35,6 +35,7 @@
 #include <sndfile.h>
 
 #include <pulse/xmalloc.h>
+#include <pulse/util.h>
 
 #include <pulsecore/core-error.h>
 #include <pulsecore/sink-input.h>
@@ -149,8 +150,6 @@
     if (!u->memblockq)
         return -1;
 
-    pa_log_debug("pop: %lu", (unsigned long) length);
-
     for (;;) {
         pa_memchunk tchunk;
         size_t fs;
@@ -158,6 +157,7 @@
         sf_count_t n;
 
         if (pa_memblockq_peek(u->memblockq, chunk) >= 0) {
+            chunk->length = PA_MIN(chunk->length, length);
             pa_memblockq_drop(u->memblockq, chunk->length);
             return 0;
         }
@@ -194,11 +194,7 @@
         pa_memblock_unref(tchunk.memblock);
     }
 
-    pa_log_debug("peek fail");
-
     if (pa_sink_input_safe_to_remove(i)) {
-        pa_log_debug("completed to play");
-
         pa_memblockq_free(u->memblockq);
         u->memblockq = NULL;
 
@@ -215,6 +211,8 @@
     pa_assert(nbytes > 0);
     u = FILE_STREAM(i->userdata);
     file_stream_assert_ref(u);
+
+    pa_log("backwards %lu", (unsigned long) nbytes);
 
     if (!u->memblockq)
         return;
@@ -330,7 +328,7 @@
     data.driver = __FILE__;
     pa_sink_input_new_data_set_sample_spec(&data, &ss);
     pa_sink_input_new_data_set_volume(&data, volume);
-    pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, fname);
+    pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, pa_path_get_filename(fname));
     pa_proplist_sets(data.proplist, PA_PROP_MEDIA_FILENAME, fname);
 
     u->sink_input = pa_sink_input_new(sink->core, &data, 0);




More information about the pulseaudio-commits mailing list