mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
resample: fix off-by-one
Don't use the previously skipped sample to calculate the remaining amount of samples or else we remove one sample too much in some cases and cause distortion, mostly when downsampling. Fixes #1646
This commit is contained in:
parent
b3646743c1
commit
4d85e6aead
1 changed files with 3 additions and 3 deletions
|
|
@ -261,10 +261,10 @@ static void impl_native_process(struct resample *r,
|
||||||
in = *in_len;
|
in = *in_len;
|
||||||
data->func(r, src, skip, &in, dst, out, out_len);
|
data->func(r, src, skip, &in, dst, out, out_len);
|
||||||
|
|
||||||
spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d",
|
spa_log_trace_fp(r->log, "native %p: in:%d/%d out %d/%d skip:%d",
|
||||||
r, *in_len, in, *out_len, out);
|
r, *in_len, in, *out_len, out, skip);
|
||||||
|
|
||||||
remain = *in_len - skip - in;
|
remain = *in_len - in;
|
||||||
if (remain > 0 && remain <= n_taps) {
|
if (remain > 0 && remain <= n_taps) {
|
||||||
/* not enough input data remaining for more output,
|
/* not enough input data remaining for more output,
|
||||||
* copy to history */
|
* copy to history */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue