mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
ebur128: work around libebur128 bug
Versions 1.2.5 and 1.2.6 don't scale the window in ms correctly, leading to excessive memory allocation, so work around this here. See https://github.com/jiixyj/libebur128/pull/132 Fixes #4646
This commit is contained in:
parent
3140ede326
commit
57326d65d9
1 changed files with 8 additions and 1 deletions
|
|
@ -235,6 +235,8 @@ static void ebur128_cleanup(void * Instance)
|
||||||
static void ebur128_activate(void * Instance)
|
static void ebur128_activate(void * Instance)
|
||||||
{
|
{
|
||||||
struct ebur128_impl *impl = Instance;
|
struct ebur128_impl *impl = Instance;
|
||||||
|
unsigned long max_window;
|
||||||
|
int major, minor, patch;
|
||||||
int mode = 0, i;
|
int mode = 0, i;
|
||||||
int modes[] = {
|
int modes[] = {
|
||||||
EBUR128_MODE_M,
|
EBUR128_MODE_M,
|
||||||
|
|
@ -264,12 +266,17 @@ static void ebur128_activate(void * Instance)
|
||||||
mode |= modes[i];
|
mode |= modes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ebur128_get_version(&major, &minor, &patch);
|
||||||
|
max_window = impl->max_window;
|
||||||
|
if (major == 1 && minor == 2 && (patch == 5 || patch == 6))
|
||||||
|
max_window = (max_window + 999) / 1000;
|
||||||
|
|
||||||
for (i = 0; i < 7; i++) {
|
for (i = 0; i < 7; i++) {
|
||||||
impl->st[i] = ebur128_init(1, impl->rate, mode);
|
impl->st[i] = ebur128_init(1, impl->rate, mode);
|
||||||
if (impl->st[i]) {
|
if (impl->st[i]) {
|
||||||
ebur128_set_channel(impl->st[i], i, channels[i]);
|
ebur128_set_channel(impl->st[i], i, channels[i]);
|
||||||
ebur128_set_max_history(impl->st[i], impl->max_history);
|
ebur128_set_max_history(impl->st[i], impl->max_history);
|
||||||
ebur128_set_max_window(impl->st[i], impl->max_window);
|
ebur128_set_max_window(impl->st[i], max_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue