diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 5a36cd518..96b9b1c5a 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -136,8 +136,6 @@ struct node { struct impl { struct pw_client_node this; - bool client_reuse; - struct pw_core *core; struct pw_type *t; @@ -1314,7 +1312,6 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource, const struct spa_support *support; uint32_t n_support; const char *name; - const char *str; impl = calloc(1, sizeof(struct impl)); if (impl == NULL) @@ -1352,9 +1349,6 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource, this->node->remote = true; - str = pw_properties_get(properties, "pipewire.client.reuse"); - impl->client_reuse = str && pw_properties_parse_bool(str); - pw_resource_add_listener(this->resource, &impl->resource_listener, &resource_events, diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 44fbff304..c13927e9b 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -108,7 +108,6 @@ struct stream { struct spa_pod *format; - bool client_reuse; uint32_t pending_seq; bool disconnecting; @@ -692,13 +691,17 @@ static int impl_node_process_input(struct spa_node *node) if ((b = get_buffer(stream, io->buffer_id)) == NULL) goto done; - push_queue(impl, &impl->dequeued, b); - call_process(impl); - - if (impl->client_reuse) - io->buffer_id = SPA_ID_INVALID; + /* push new buffer */ + if (push_queue(impl, &impl->dequeued, b) == 0) + call_process(impl); done: + /* pop buffer to recycle */ + if ((b = pop_queue(impl, &impl->queued)) != NULL) + io->buffer_id = b->id; + else + io->buffer_id = SPA_ID_INVALID; + io->status = SPA_STATUS_NEED_BUFFER; return SPA_STATUS_HAVE_BUFFER; } @@ -760,7 +763,6 @@ struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, { struct stream *impl; struct pw_stream *this; - const char *str; impl = calloc(1, sizeof(struct stream)); if (impl == NULL) @@ -784,9 +786,6 @@ struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, init_type(&impl->type, remote->core->type.map); - str = pw_properties_get(props, "pipewire.client.reuse"); - impl->client_reuse = str && pw_properties_parse_bool(str); - spa_ringbuffer_init(&impl->dequeued.ring); spa_ringbuffer_init(&impl->queued.ring); @@ -1169,6 +1168,7 @@ int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer) { struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this); struct buffer *b; + int res; if ((b = get_buffer(stream, buffer->buffer->id)) == NULL) { pw_log_error("stream %p: invalid buffer %d", stream, buffer->buffer->id); @@ -1176,7 +1176,8 @@ int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer) } pw_log_trace("stream %p: queue buffer %d", stream, b->id); - push_queue(impl, &impl->queued, b); + if ((res = push_queue(impl, &impl->queued, b)) < 0) + return res; if (SPA_FLAG_CHECK(impl->flags, PW_STREAM_FLAG_DRIVER)) { pw_loop_invoke(impl->core->data_loop,