Commit 4743a423 authored by Wim Taymans's avatar Wim Taymans
Browse files

stream: only remove buffer when added

parent 8ecae078
......@@ -57,6 +57,7 @@ struct buffer {
uint32_t id;
#define BUFFER_FLAG_MAPPED (1 << 0)
#define BUFFER_FLAG_QUEUED (1 << 1)
#define BUFFER_FLAG_ADDED (1 << 2)
uint32_t flags;
};
......@@ -585,6 +586,7 @@ static void clear_buffers(struct port *port)
for (i = 0; i < port->n_buffers; i++) {
struct buffer *b = &port->buffers[i];
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_ADDED))
pw_filter_emit_remove_buffer(&impl->this, port->user_data, &b->this);
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
......@@ -704,6 +706,7 @@ static int impl_port_use_buffers(void *object,
push_queue(port, &port->dequeued, b);
}
SPA_FLAG_SET(b->flags, BUFFER_FLAG_ADDED);
pw_filter_emit_add_buffer(filter, port->user_data, &b->this);
}
......
......@@ -54,6 +54,7 @@ struct buffer {
uint32_t id;
#define BUFFER_FLAG_MAPPED (1 << 0)
#define BUFFER_FLAG_QUEUED (1 << 1)
#define BUFFER_FLAG_ADDED (1 << 2)
uint32_t flags;
};
......@@ -585,6 +586,7 @@ static void clear_buffers(struct pw_stream *stream)
for (i = 0; i < impl->n_buffers; i++) {
struct buffer *b = &impl->buffers[i];
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_ADDED))
pw_stream_emit_remove_buffer(stream, &b->this);
if (SPA_FLAG_IS_SET(b->flags, BUFFER_FLAG_MAPPED)) {
......@@ -696,6 +698,7 @@ static int impl_port_use_buffers(void *object,
push_queue(impl, &impl->dequeued, b);
}
SPA_FLAG_SET(b->flags, BUFFER_FLAG_ADDED);
pw_stream_emit_add_buffer(stream, &b->this);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment