module-profiler: make sure we don't overrun the flush buffer

Check that the node profiler data fits in the flush buffer.
This commit is contained in:
Wim Taymans 2023-08-01 18:14:53 +02:00
parent 0cbcf88eaa
commit 121228bde8

View file

@ -134,13 +134,15 @@ static void do_flush_event(void *data, uint64_t count)
pw_log_trace("%p avail %d", impl, avail);
if (avail > 0) {
if (total + avail < FLUSH_BUFFER) {
spa_ringbuffer_read_data(&n->buffer, n->data, DATA_BUFFER,
idx % DATA_BUFFER,
SPA_PTROFF(p, sizeof(struct spa_pod_struct) + total, void),
avail);
spa_ringbuffer_read_update(&n->buffer, idx + avail);
total += avail;
}
spa_ringbuffer_read_update(&n->buffer, idx + avail);
}
}
*p = SPA_POD_INIT_Struct(total);