The resampler framework just forwards the request to the lfe filter. There are no resampler impl that can rewind yet, so just reset the resampler impl instead of properly rewinding yet. Signed-off-by: David Henningsson <david.henningsson at canonical.com> --- src/pulsecore/resampler.c | 18 ++++++++++++++++-- src/pulsecore/resampler.h | 3 +++ src/pulsecore/sink-input.c | 4 ++-- src/pulsecore/source-output.c | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index db29698..f5a0e16 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -578,6 +578,20 @@ void pa_resampler_reset(pa_resampler *r) { *r->have_leftover = false; } +void pa_resampler_rewind(pa_resampler *r, size_t out_frames) { + pa_assert(r); + + /* For now, we don't have any rewindable resamplers, so we just + reset the resampler instead (and hope that nobody hears the difference). */ + if (r->impl.reset) + r->impl.reset(r); + + if (r->lfe_filter) + pa_lfe_filter_rewind(r->lfe_filter, out_frames); + + *r->have_leftover = false; +} + pa_resample_method_t pa_resampler_get_method(pa_resampler *r) { pa_assert(r); @@ -818,8 +832,8 @@ static void setup_remap(const pa_resampler *r, pa_remap_t *m, bool *lfe_filter_r } else { /* OK, we shall do the full monty: upmixing and downmixing. Our - * algorithm is relatively simple, does not do spacialization, delay - * elements or apply lowpass filters for LFE. Patches are always + * algorithm is relatively simple, does not do spacialization, or delay + * elements. LFE filters are done after the remap step. Patches are always * welcome, though. Oh, and it doesn't do any matrix decoding. (Which * probably wouldn't make any sense anyway.) * diff --git a/src/pulsecore/resampler.h b/src/pulsecore/resampler.h index 3bc1054..4469022 100644 --- a/src/pulsecore/resampler.h +++ b/src/pulsecore/resampler.h @@ -145,6 +145,9 @@ void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate); /* Reinitialize state of the resampler, possibly due to seeking or other discontinuities */ void pa_resampler_reset(pa_resampler *r); +/* Rewind resampler */ +void pa_resampler_rewind(pa_resampler *r, size_t out_frames); + /* Return the resampling method of the resampler object */ pa_resample_method_t pa_resampler_get_method(pa_resampler *r); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 7d2202e..fe980c3 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -1106,9 +1106,9 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam if (i->thread_info.rewrite_flush) pa_memblockq_silence(i->thread_info.render_memblockq); - /* And reset the resampler */ + /* And rewind the resampler */ if (i->thread_info.resampler) - pa_resampler_reset(i->thread_info.resampler); + pa_resampler_rewind(i->thread_info.resampler, amount); } } diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 4cc1053..9000972 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -851,7 +851,7 @@ void pa_source_output_process_rewind(pa_source_output *o, size_t nbytes /* in so o->process_rewind(o, nbytes); if (o->thread_info.resampler) - pa_resampler_reset(o->thread_info.resampler); + pa_resampler_rewind(o->thread_info.resampler, nbytes); } else pa_memblockq_rewind(o->thread_info.delay_memblockq, nbytes); -- 1.9.1