mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
audioconvert: add resample.prefill option
Add a resampler option to prefill the resampler with 0. This then results in the resampler always outputing and consuming the same amount of data instead of a short buffer in the beginning.
This commit is contained in:
parent
d48627d0e7
commit
31f9e18edb
3 changed files with 8 additions and 1 deletions
|
|
@ -2844,6 +2844,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
spa_atou32(s, &this->quantum_limit, 0);
|
spa_atou32(s, &this->quantum_limit, 0);
|
||||||
else if (spa_streq(k, "resample.peaks"))
|
else if (spa_streq(k, "resample.peaks"))
|
||||||
this->peaks = spa_atob(s);
|
this->peaks = spa_atob(s);
|
||||||
|
else if (spa_streq(k, "resample.prefill"))
|
||||||
|
this->resample.options |= RESAMPLE_OPTION_PREFILL;
|
||||||
else if (spa_streq(k, "factory.mode")) {
|
else if (spa_streq(k, "factory.mode")) {
|
||||||
if (spa_streq(s, "merge"))
|
if (spa_streq(s, "merge"))
|
||||||
this->direction = SPA_DIRECTION_OUTPUT;
|
this->direction = SPA_DIRECTION_OUTPUT;
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,10 @@ static void impl_native_reset (struct resample *r)
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return;
|
return;
|
||||||
memset(d->hist_mem, 0, r->channels * sizeof(float) * d->n_taps * 2);
|
memset(d->hist_mem, 0, r->channels * sizeof(float) * d->n_taps * 2);
|
||||||
d->hist = (d->n_taps / 2) - 1;
|
if (r->options & RESAMPLE_OPTION_PREFILL)
|
||||||
|
d->hist = d->n_taps - 1;
|
||||||
|
else
|
||||||
|
d->hist = (d->n_taps / 2) - 1;
|
||||||
d->phase = 0;
|
d->phase = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
struct resample {
|
struct resample {
|
||||||
struct spa_log *log;
|
struct spa_log *log;
|
||||||
|
#define RESAMPLE_OPTION_PREFILL (1<<0)
|
||||||
|
uint32_t options;
|
||||||
uint32_t cpu_flags;
|
uint32_t cpu_flags;
|
||||||
const char *func_name;
|
const char *func_name;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue