mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: libcamera: source: remove stale data from buffers
When clearing the buffers, remove the stale pointers and file descriptors as accidental reuse of those is problematic and potentially difficult to diagnose. Do this for every data plane. Also clear the node's `buffer` structures to remove any references to the provided `spa_buffer` objects and related metadata.
This commit is contained in:
parent
bf327d3dfb
commit
b82160c2e7
1 changed files with 10 additions and 5 deletions
|
|
@ -374,13 +374,18 @@ err:
|
|||
int spa_libcamera_clear_buffers(struct port *port)
|
||||
{
|
||||
for (std::size_t i = 0; i < port->n_buffers; i++) {
|
||||
struct buffer *b;
|
||||
struct spa_data *d;
|
||||
buffer *b = &port->buffers[i];
|
||||
spa_buffer *sb = b->outbuf;
|
||||
|
||||
b = &port->buffers[i];
|
||||
d = b->outbuf->datas;
|
||||
for (std::size_t j = 0; j < sb->n_datas; j++) {
|
||||
auto *d = &sb->datas[j];
|
||||
|
||||
d[0].type = SPA_ID_INVALID;
|
||||
d->type = SPA_ID_INVALID;
|
||||
d->data = nullptr;
|
||||
d->fd = -1;
|
||||
}
|
||||
|
||||
*b = {};
|
||||
}
|
||||
|
||||
port->n_buffers = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue