[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 2 commits: source-output: Fix rewinding bug

Arun Raghavan gitlab at gitlab.freedesktop.org
Wed Jul 3 11:06:30 UTC 2019



Arun Raghavan pushed to branch master at PulseAudio / pulseaudio


Commits:
1240afab by Georg Chini at 2019-07-03T10:52:20Z
source-output: Fix rewinding bug

Currently the rewind logic for the source output is broken if the output
does not implement a process_rewind() callback. In that case, the read
index of the delay memblockq is rewound. This is wrong, because the data
that is going to be re-written was not yet read. Instead the write index
should be rewound and the read index left untouched. This is the reason
for the rewind glitches of monitor sources.

- - - - -
4c6bab43 by Georg Chini at 2019-07-03T10:52:20Z
sink-input: fix rewriting render memblockq when nothing should be rewound

If process_rewind() is called with nbytes = 0, process_rewind() will
nevertheless request a rewrite of the render memblockq.

This patch fixes the problem by adding the render memblockq length to the
rewrite amount only if nbytes > 0.

- - - - -


2 changed files:

- src/pulsecore/sink-input.c
- src/pulsecore/source-output.c


Changes:

=====================================
src/pulsecore/sink-input.c
=====================================
@@ -1094,7 +1094,9 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
         size_t max_rewrite, amount;
 
         /* Calculate how much make sense to rewrite at most */
-        max_rewrite = nbytes + lbq;
+        max_rewrite = nbytes;
+        if (nbytes > 0)
+            max_rewrite += lbq;
 
         /* Transform into local domain */
         if (i->thread_info.resampler)


=====================================
src/pulsecore/source-output.c
=====================================
@@ -866,7 +866,7 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in so
             pa_resampler_rewind(o->thread_info.resampler, nbytes);
 
     } else
-        pa_memblockq_rewind(o->thread_info.delay_memblockq, nbytes);
+        pa_memblockq_seek(o->thread_info.delay_memblockq, - ((int64_t) nbytes), PA_SEEK_RELATIVE, true);
 }
 
 /* Called from thread context */



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/f89d64b98e12bb71b6aa94fcef31eafc060f9759...4c6bab435316768974b94573e3f67ea17f56e221

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/compare/f89d64b98e12bb71b6aa94fcef31eafc060f9759...4c6bab435316768974b94573e3f67ea17f56e221
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20190703/1fa719e4/attachment.html>


More information about the pulseaudio-commits mailing list