Skip to content
Commits on Source (2)
  • Georg Chini's avatar
    source-output: Fix rewinding bug · 1240afab
    Georg Chini authored and Arun Raghavan's avatar Arun Raghavan committed
    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.
    1240afab
  • Georg Chini's avatar
    sink-input: fix rewriting render memblockq when nothing should be rewound · 4c6bab43
    Georg Chini authored and Arun Raghavan's avatar Arun Raghavan committed
    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.
    4c6bab43
......@@ -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)
......
......@@ -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 */
......