mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
impl-node: add backwards compat for old clients
Bump the client-node version to 6. Older clients expect the server to prepare the activation counters so make a flag to do that.
This commit is contained in:
parent
46f71b1cd2
commit
722e646f90
4 changed files with 26 additions and 10 deletions
|
|
@ -1799,6 +1799,13 @@ struct pw_impl_client_node *pw_impl_client_node_new(struct pw_resource *resource
|
|||
|
||||
this->node->remote = true;
|
||||
this->flags = 0;
|
||||
if (resource->version < 5) {
|
||||
pw_log_warn("using server side driver for old client version %d", resource->version);
|
||||
}
|
||||
if (resource->version < 6) {
|
||||
this->node->server_prepare = true;
|
||||
pw_log_warn("using server side prepare for old client version %d", resource->version);
|
||||
}
|
||||
|
||||
pw_resource_add_listener(this->resource,
|
||||
&impl->resource_listener,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ extern "C" {
|
|||
*/
|
||||
#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
|
||||
|
||||
#define PW_VERSION_CLIENT_NODE 5
|
||||
/*
|
||||
* version 4: new port_set_mix_info event added
|
||||
* version 5: driver nodes are scheduled on the client
|
||||
* version 6: nodes activate peer links themselves when ready
|
||||
*/
|
||||
#define PW_VERSION_CLIENT_NODE 6
|
||||
struct pw_client_node;
|
||||
|
||||
#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
|
||||
|
|
|
|||
|
|
@ -154,17 +154,19 @@ do_node_prepare(struct spa_loop *loop, bool async, uint32_t seq,
|
|||
if (this->rt.prepared)
|
||||
return 0;
|
||||
|
||||
/* clear the eventfd in case it was written to while the node was stopped */
|
||||
res = spa_system_eventfd_read(this->rt.target.system, this->source.fd, &dummy);
|
||||
if (SPA_UNLIKELY(res != -EAGAIN && res != 0))
|
||||
pw_log_warn("%p: read failed %m", this);
|
||||
if (!this->server_prepare) {
|
||||
/* clear the eventfd in case it was written to while the node was stopped */
|
||||
res = spa_system_eventfd_read(this->rt.target.system, this->source.fd, &dummy);
|
||||
if (SPA_UNLIKELY(res != -EAGAIN && res != 0))
|
||||
pw_log_warn("%p: read failed %m", this);
|
||||
|
||||
spa_loop_add_source(loop, &this->source);
|
||||
}
|
||||
SPA_ATOMIC_STORE(this->rt.target.activation->status, PW_NODE_ACTIVATION_FINISHED);
|
||||
spa_loop_add_source(loop, &this->source);
|
||||
|
||||
spa_list_for_each(t, &this->rt.target_list, link) {
|
||||
/* we can now trigger ourself */
|
||||
if (t->id == this->info.id)
|
||||
if (t->id == this->info.id || this->server_prepare)
|
||||
activate_target(this, t);
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +202,8 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq,
|
|||
spa_list_for_each(t, &this->rt.target_list, link)
|
||||
deactivate_target(this, t, trigger);
|
||||
|
||||
spa_loop_remove_source(loop, &this->source);
|
||||
if (!this->server_prepare)
|
||||
spa_loop_remove_source(loop, &this->source);
|
||||
|
||||
this->rt.prepared = false;
|
||||
return 0;
|
||||
|
|
@ -208,7 +211,7 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq,
|
|||
|
||||
static void add_node_to_graph(struct pw_impl_node *node)
|
||||
{
|
||||
if (node->remote)
|
||||
if (node->remote && !node->server_prepare)
|
||||
return;
|
||||
|
||||
pw_loop_invoke(node->data_loop, do_node_prepare, 1, NULL, 0, true, node);
|
||||
|
|
@ -216,7 +219,7 @@ static void add_node_to_graph(struct pw_impl_node *node)
|
|||
|
||||
static void remove_node_from_graph(struct pw_impl_node *node)
|
||||
{
|
||||
if (node->remote)
|
||||
if (node->remote && !node->server_prepare)
|
||||
return;
|
||||
|
||||
pw_loop_invoke(node->data_loop, do_node_unprepare, 1, NULL, 0, true, node);
|
||||
|
|
|
|||
|
|
@ -740,6 +740,7 @@ struct pw_impl_node {
|
|||
unsigned int sync:1; /**< the sync-groups are active */
|
||||
unsigned int transport:1; /**< the transport is active */
|
||||
unsigned int async:1; /**< async processing, one cycle latency */
|
||||
unsigned int server_prepare:1; /**< prepare links server side for old clients */
|
||||
|
||||
uint32_t port_user_data_size; /**< extra size for port user data */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue