[pulseaudio-commits] r2220 - /branches/glitch-free/src/pulsecore/sink-input.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Apr 7 09:47:28 PDT 2008


Author: lennart
Date: Mon Apr  7 18:47:27 2008
New Revision: 2220

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2220&root=pulseaudio&view=rev
Log:
fix bug where we silently dropped data that didn't fit into one mempool tile

Modified:
    branches/glitch-free/src/pulsecore/sink-input.c

Modified: branches/glitch-free/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/sink-input.c?rev=2220&root=pulseaudio&r1=2219&r2=2220&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/sink-input.c (original)
+++ branches/glitch-free/src/pulsecore/sink-input.c Mon Apr  7 18:47:27 2008
@@ -517,29 +517,38 @@
         pa_assert(tchunk.length > 0);
         pa_assert(tchunk.memblock);
 
-        if (tchunk.length > block_size_max_sink_input)
-            tchunk.length = block_size_max_sink_input;
-
-        /* It might be necessary to adjust the volume here */
-        if (do_volume_adj_here && !volume_is_norm) {
-            pa_memchunk_make_writable(&tchunk, 0);
-
-            if (i->thread_info.muted)
-                pa_silence_memchunk(&tchunk, &i->thread_info.sample_spec);
-            else
-                pa_volume_memchunk(&tchunk, &i->thread_info.sample_spec, &i->thread_info.volume);
-        }
-
-        if (!i->thread_info.resampler)
-            pa_memblockq_push_align(i->thread_info.render_memblockq, &tchunk);
-        else {
-            pa_memchunk rchunk;
-            pa_resampler_run(i->thread_info.resampler, &tchunk, &rchunk);
-
-            if (rchunk.memblock) {
-                pa_memblockq_push_align(i->thread_info.render_memblockq, &rchunk);
-                pa_memblock_unref(rchunk.memblock);
+        while (tchunk.length > 0) {
+            pa_memchunk wchunk;
+
+            wchunk = tchunk;
+
+            if (wchunk.length > block_size_max_sink_input)
+                wchunk.length = block_size_max_sink_input;
+
+            /* It might be necessary to adjust the volume here */
+            if (do_volume_adj_here && !volume_is_norm) {
+                pa_memchunk_make_writable(&wchunk, 0);
+
+                if (i->thread_info.muted)
+                    pa_silence_memchunk(&wchunk, &i->thread_info.sample_spec);
+                else
+                    pa_volume_memchunk(&wchunk, &i->thread_info.sample_spec, &i->thread_info.volume);
             }
+
+            if (!i->thread_info.resampler)
+                pa_memblockq_push_align(i->thread_info.render_memblockq, &wchunk);
+            else {
+                pa_memchunk rchunk;
+                pa_resampler_run(i->thread_info.resampler, &wchunk, &rchunk);
+
+                if (rchunk.memblock) {
+                    pa_memblockq_push_align(i->thread_info.render_memblockq, &rchunk);
+                    pa_memblock_unref(rchunk.memblock);
+                }
+            }
+
+            tchunk.index += wchunk.length;
+            tchunk.length -= wchunk.length;
         }
 
         pa_memblock_unref(tchunk.memblock);




More information about the pulseaudio-commits mailing list