mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
spa-resample: flush last samples
Use 0 samples to flush out the last samples from the resampler.
This commit is contained in:
parent
039f6751e1
commit
6603fab405
1 changed files with 13 additions and 2 deletions
|
|
@ -158,6 +158,7 @@ static int do_conversion(struct data *d)
|
||||||
void *dst[channels];
|
void *dst[channels];
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int j, k, queued;
|
int j, k, queued;
|
||||||
|
bool flushing = false;
|
||||||
|
|
||||||
spa_zero(r);
|
spa_zero(r);
|
||||||
r.log = &logger.log;
|
r.log = &logger.log;
|
||||||
|
|
@ -178,8 +179,18 @@ static int do_conversion(struct data *d)
|
||||||
in_len = SPA_MIN(MAX_SAMPLES, (int)resample_in_len(&r, out_len)) - queued;
|
in_len = SPA_MIN(MAX_SAMPLES, (int)resample_in_len(&r, out_len)) - queued;
|
||||||
|
|
||||||
pin_len = in_len = sf_readf_float(d->ifile, &ibuf[queued * channels], in_len);
|
pin_len = in_len = sf_readf_float(d->ifile, &ibuf[queued * channels], in_len);
|
||||||
if (pin_len == 0)
|
if (pin_len == 0) {
|
||||||
break;
|
if (flushing)
|
||||||
|
break;
|
||||||
|
|
||||||
|
flushing = true;
|
||||||
|
pin_len = in_len = resample_delay(&r);
|
||||||
|
|
||||||
|
for (k = 0, i = 0; i < pin_len; i++) {
|
||||||
|
for (j = 0; j < channels; j++)
|
||||||
|
ibuf[k++] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
in_len += queued;
|
in_len += queued;
|
||||||
pin_len = in_len;
|
pin_len = in_len;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue