mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pipewire/stream: Don't queue back cleared buffers
When renegotiating stream parameters (e.g. size), the buffers are cleared should no longer be queued back. Add a flag to detect this, while logging a warning and erroring out when the user tries to queue such a buffer.
This commit is contained in:
parent
0095d79ef8
commit
220bdf8a00
1 changed files with 12 additions and 1 deletions
|
|
@ -40,7 +40,8 @@ struct buffer {
|
|||
uint32_t id;
|
||||
#define BUFFER_FLAG_MAPPED (1 << 0)
|
||||
#define BUFFER_FLAG_QUEUED (1 << 1)
|
||||
#define BUFFER_FLAG_ADDED (1 << 2)
|
||||
#define BUFFER_FLAG_DEQUEUED (1 << 2)
|
||||
#define BUFFER_FLAG_ADDED (1 << 3)
|
||||
uint32_t flags;
|
||||
struct spa_meta_busy *busy;
|
||||
};
|
||||
|
|
@ -2513,6 +2514,9 @@ struct pw_buffer *pw_stream_dequeue_buffer(struct pw_stream *stream)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_DEQUEUED);
|
||||
|
||||
return &b->this;
|
||||
}
|
||||
|
||||
|
|
@ -2523,6 +2527,13 @@ int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer)
|
|||
struct buffer *b = SPA_CONTAINER_OF(buffer, struct buffer, this);
|
||||
int res;
|
||||
|
||||
if (!SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_DEQUEUED)) {
|
||||
pw_log_warn("%p: tried to queue cleared buffer %d", stream, b->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
SPA_FLAG_CLEAR(b->flags, BUFFER_FLAG_DEQUEUED);
|
||||
|
||||
if (b->busy)
|
||||
SPA_ATOMIC_DEC(b->busy->count);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue