mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
impl-node: use the added boolean to add/remove source
There is no reason to use the loop of the source.
This commit is contained in:
parent
7d4491ce6b
commit
8f799af6df
1 changed files with 5 additions and 5 deletions
|
|
@ -144,8 +144,7 @@ do_node_add(struct spa_loop *loop, bool async, uint32_t seq, const void *data, s
|
||||||
struct pw_impl_node *this = user_data;
|
struct pw_impl_node *this = user_data;
|
||||||
struct pw_impl_node *driver = this->driver_node;
|
struct pw_impl_node *driver = this->driver_node;
|
||||||
|
|
||||||
this->added = true;
|
if (!this->added) {
|
||||||
if (this->source.loop == NULL) {
|
|
||||||
struct spa_system *data_system = this->data_system;
|
struct spa_system *data_system = this->data_system;
|
||||||
uint64_t dummy;
|
uint64_t dummy;
|
||||||
int res;
|
int res;
|
||||||
|
|
@ -155,6 +154,7 @@ do_node_add(struct spa_loop *loop, bool async, uint32_t seq, const void *data, s
|
||||||
if (SPA_UNLIKELY(res != -EAGAIN && res != 0))
|
if (SPA_UNLIKELY(res != -EAGAIN && res != 0))
|
||||||
pw_log_warn("%p: read failed %m", this);
|
pw_log_warn("%p: read failed %m", this);
|
||||||
|
|
||||||
|
this->added = true;
|
||||||
spa_loop_add_source(loop, &this->source);
|
spa_loop_add_source(loop, &this->source);
|
||||||
add_node(this, driver);
|
add_node(this, driver);
|
||||||
}
|
}
|
||||||
|
|
@ -165,11 +165,11 @@ static int
|
||||||
do_node_remove(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
do_node_remove(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
|
||||||
{
|
{
|
||||||
struct pw_impl_node *this = user_data;
|
struct pw_impl_node *this = user_data;
|
||||||
if (this->source.loop != NULL) {
|
if (this->added) {
|
||||||
spa_loop_remove_source(loop, &this->source);
|
spa_loop_remove_source(loop, &this->source);
|
||||||
remove_node(this);
|
remove_node(this);
|
||||||
|
this->added = false;
|
||||||
}
|
}
|
||||||
this->added = false;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -810,7 +810,7 @@ do_move_nodes(struct spa_loop *loop,
|
||||||
node->target_rate = node->rt.position->clock.target_rate;
|
node->target_rate = node->rt.position->clock.target_rate;
|
||||||
node->target_quantum = node->rt.position->clock.target_duration;
|
node->target_quantum = node->rt.position->clock.target_duration;
|
||||||
|
|
||||||
if (node->source.loop != NULL) {
|
if (node->added) {
|
||||||
remove_node(node);
|
remove_node(node);
|
||||||
add_node(node, driver);
|
add_node(node, driver);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue