filter: return NULL when no DSP buffer is available

Instead of returning the dummy empty buffer.

The dummy buffer is problematic in various ways:

1) it has a fixed hardcoded size and doesn't adapt to the quantum_limit.
2) when used as output buffer, data is written to the void with no
   indication for the application.
3) using random data as an input buffer is going to cause unexpected
   noise with no indication to the application.
This commit is contained in:
Wim Taymans 2022-01-12 19:15:13 +01:00
parent 622851001e
commit 844eee678a

View file

@ -52,7 +52,6 @@ PW_LOG_TOPIC_EXTERN(log_filter);
#define MASK_BUFFERS (MAX_BUFFERS-1) #define MASK_BUFFERS (MAX_BUFFERS-1)
#define MAX_PORTS 1024 #define MAX_PORTS 1024
static float empty[MAX_SAMPLES];
static bool mlock_warned = false; static bool mlock_warned = false;
static uint32_t mappable_dataTypes = (1<<SPA_DATA_MemFd); static uint32_t mappable_dataTypes = (1<<SPA_DATA_MemFd);
@ -1860,7 +1859,7 @@ void *pw_filter_get_dsp_buffer(void *port_data, uint32_t n_samples)
struct spa_data *d; struct spa_data *d;
if ((buf = pw_filter_dequeue_buffer(port_data)) == NULL) if ((buf = pw_filter_dequeue_buffer(port_data)) == NULL)
return empty; return NULL;
d = &buf->buffer->datas[0]; d = &buf->buffer->datas[0];