audioconvert: add dither noise even on empty input

When we are asked to add noise bits, don't call the clear function.

Make the passthrough and clear-on-empty flags available with a new flag
field to make it more extensible.

Fixes #5260
This commit is contained in:
Wim Taymans 2026-05-14 11:19:02 +02:00
parent 4f975d0071
commit 61431dcbc0
3 changed files with 17 additions and 11 deletions

View file

@ -640,7 +640,8 @@ int convert_init(struct convert *conv)
for (i = 0; i < RANDOM_SIZE; i++)
conv->random[i] = random();
conv->is_passthrough = conv->src_fmt == conv->dst_fmt;
SPA_FLAG_UPDATE(conv->flags, CONVERT_FLAG_CLEAR_ON_EMPTY, conv->noise_bits == 0);
SPA_FLAG_UPDATE(conv->flags, CONVERT_FLAG_PASSTHROUGH, conv->src_fmt == conv->dst_fmt);
conv->func_cpu_flags = info->cpu_flags;
conv->update_noise = ninfo->noise;
conv->process = info->process;