mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
client-node: don't misuse ASYNC flag
When the client is explicitly going to send reuse_buffer messages, set the consumed buffer to INVALID so it doesn't automatically get reused. ASYNC is for when the node emits events to signal input and output it has nothing to do with reuse_buffer Remove weird PROCESS_INPUT code.
This commit is contained in:
parent
28bf6137d3
commit
9706c191b9
2 changed files with 15 additions and 38 deletions
|
|
@ -31,13 +31,11 @@
|
|||
#include "spa/node.h"
|
||||
#include "spa/format-builder.h"
|
||||
#include "spa/lib/format.h"
|
||||
#include "spa/graph.h"
|
||||
|
||||
#include "pipewire/pipewire.h"
|
||||
#include "pipewire/interfaces.h"
|
||||
|
||||
#include "pipewire/core.h"
|
||||
#include "pipewire/private.h"
|
||||
#include "modules/spa/spa-node.h"
|
||||
#include "client-node.h"
|
||||
#include "transport.h"
|
||||
|
|
@ -767,18 +765,14 @@ static int spa_proxy_node_process_input(struct spa_node *node)
|
|||
|
||||
impl->transport->inputs[i] = *io;
|
||||
|
||||
if (impl->client_reuse) {
|
||||
io->status = SPA_RESULT_OK;
|
||||
if (impl->client_reuse)
|
||||
io->buffer_id = SPA_ID_INVALID;
|
||||
} else {
|
||||
io->status = SPA_RESULT_NEED_BUFFER;
|
||||
}
|
||||
}
|
||||
pw_client_node_transport_add_message(impl->transport,
|
||||
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_PROCESS_INPUT));
|
||||
do_flush(this);
|
||||
|
||||
if (this->callbacks->need_input || impl->client_reuse)
|
||||
if (this->callbacks->need_input)
|
||||
return SPA_RESULT_OK;
|
||||
else
|
||||
return SPA_RESULT_NEED_BUFFER;
|
||||
|
|
@ -1190,11 +1184,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
|
|||
goto error_no_node;
|
||||
|
||||
str = pw_properties_get(properties, "pipewire.client.reuse");
|
||||
impl->client_reuse = str && strcmp(str, "1") == 0;
|
||||
if (impl->client_reuse)
|
||||
this->node->rt.node.flags |= SPA_GRAPH_NODE_FLAG_ASYNC;
|
||||
else
|
||||
this->node->rt.node.flags &= ~SPA_GRAPH_NODE_FLAG_ASYNC;
|
||||
impl->client_reuse = str && pw_properties_parse_bool(str);
|
||||
|
||||
pw_resource_add_listener(this->resource,
|
||||
&impl->resource_listener,
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ struct pw_stream *pw_stream_new(struct pw_remote *remote,
|
|||
impl->rtwritefd = -1;
|
||||
|
||||
str = pw_properties_get(props, "pipewire.client.reuse");
|
||||
impl->client_reuse = str && strcmp(str, "1") == 0;
|
||||
impl->client_reuse = str && pw_properties_parse_bool(str);
|
||||
|
||||
spa_hook_list_init(&this->listener_list);
|
||||
|
||||
|
|
@ -528,34 +528,21 @@ static void handle_rtnode_message(struct pw_stream *stream, struct pw_client_nod
|
|||
|
||||
for (i = 0; i < impl->trans->area->n_input_ports; i++) {
|
||||
struct spa_port_io *input = &impl->trans->inputs[i];
|
||||
uint32_t len, first, id;
|
||||
struct buffer_id *bid;
|
||||
uint32_t buffer_id;
|
||||
|
||||
buffer_id = input->buffer_id;
|
||||
input->buffer_id = SPA_ID_INVALID;
|
||||
|
||||
pw_log_trace("stream %p: process input %d %d", stream, input->status,
|
||||
input->buffer_id);
|
||||
if (input->buffer_id == SPA_ID_INVALID)
|
||||
buffer_id);
|
||||
|
||||
if ((bid = find_buffer(stream, buffer_id)) == NULL)
|
||||
continue;
|
||||
|
||||
len = pw_array_get_len(&impl->buffer_ids, struct buffer_id);
|
||||
if (impl->client_reuse && impl->last_buffer_id[i] != SPA_ID_INVALID)
|
||||
first = (impl->last_buffer_id[i] + 1) % len;
|
||||
else
|
||||
first = input->buffer_id;
|
||||
|
||||
id = first;
|
||||
while (true) {
|
||||
struct buffer_id *bid;
|
||||
|
||||
bid = find_buffer(stream, id);
|
||||
bid->used = true;
|
||||
|
||||
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
|
||||
new_buffer, id);
|
||||
impl->last_buffer_id[i] = id;
|
||||
|
||||
if (id == input->buffer_id)
|
||||
break;
|
||||
id = (id + 1) % len;
|
||||
}
|
||||
bid->used = true;
|
||||
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
|
||||
new_buffer, buffer_id);
|
||||
}
|
||||
send_need_input(stream);
|
||||
} else if (PW_CLIENT_NODE_MESSAGE_TYPE(message) == PW_CLIENT_NODE_MESSAGE_PROCESS_OUTPUT) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue