mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-06 07:15:35 -04:00
filter-graph: handle NULL data
Because the max plugin is marked as SUPPORTS_NULL, the input and output pointers can be NULL. Handle these cases. Also reindent with tabs (not 7 spaces).
This commit is contained in:
parent
7f80711158
commit
6e2f631230
1 changed files with 30 additions and 19 deletions
|
|
@ -2086,13 +2086,24 @@ static void max_run(void * Instance, unsigned long SampleCount)
|
||||||
{
|
{
|
||||||
struct builtin *impl = Instance;
|
struct builtin *impl = Instance;
|
||||||
float *out = impl->port[0], *in1 = impl->port[1], *in2 = impl->port[2];
|
float *out = impl->port[0], *in1 = impl->port[1], *in2 = impl->port[2];
|
||||||
|
unsigned long n;
|
||||||
|
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned long n;
|
if (in1 != NULL && in2 != NULL) {
|
||||||
for (n = 0; n < SampleCount; n++)
|
for (n = 0; n < SampleCount; n++) {
|
||||||
out[n] = SPA_MAX(in1[n], in2[n]);
|
out[n] = fmaxf(in1[n], in2[n]);
|
||||||
|
} else if (in1 != NULL) {
|
||||||
|
for (n = 0; n < SampleCount; n++) {
|
||||||
|
out[n] = in1[n];
|
||||||
|
} else if (in2 != NULL) {
|
||||||
|
for (n = 0; n < SampleCount; n++) {
|
||||||
|
out[n] = in2[n];
|
||||||
|
} else {
|
||||||
|
for (n = 0; n < SampleCount; n++) {
|
||||||
|
out[n] = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spa_fga_port max_ports[] = {
|
static struct spa_fga_port max_ports[] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue