From bb4a45ebafa5e31af581a7bf1b4375c58209f01d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 23 May 2022 15:39:17 +0200 Subject: [PATCH] zita-resampler: pass-through data if not configured This is in preparation to allow fixed-speed processing without resampler latency --- libs/zita-resampler/vmresampler.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/zita-resampler/vmresampler.cc b/libs/zita-resampler/vmresampler.cc index 9193d09cd6..87a68d371b 100644 --- a/libs/zita-resampler/vmresampler.cc +++ b/libs/zita-resampler/vmresampler.cc @@ -169,7 +169,13 @@ VMResampler::process (void) double ph, dp; float a, *p1, *p2; - if (!_table) return 1; + if (!_table) { + n = std::min (inp_count, out_count); + memcpy (out_data, inp_data, n * sizeof (float)); + out_count -= n; + inp_count -= n; + return 1; + } const int hl = _table->_hl; const unsigned int np = _table->_np; @@ -208,6 +214,7 @@ VMResampler::process (void) out_count -= to_proc; in += to_proc; if (in >= _inmax) { + // assert (_inmax == in) memcpy (_buff, _buff + in, (2 * hl - 1) * sizeof (float)); in = 0; }