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:
Wim Taymans 2024-12-04 16:30:33 +01:00
parent 7f80711158
commit 6e2f631230

View file

@ -2086,13 +2086,24 @@ static void max_run(void * Instance, unsigned long SampleCount)
{
struct builtin *impl = Instance;
float *out = impl->port[0], *in1 = impl->port[1], *in2 = impl->port[2];
unsigned long n;
if (out == NULL)
return;
unsigned long n;
for (n = 0; n < SampleCount; n++)
out[n] = SPA_MAX(in1[n], in2[n]);
if (in1 != NULL && in2 != NULL) {
for (n = 0; n < SampleCount; 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[] = {