mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
improve states
This commit is contained in:
parent
e92e1acec4
commit
fd5f0d96f3
5 changed files with 21 additions and 14 deletions
|
|
@ -924,22 +924,24 @@ do_link_remove_done (SpaLoop *loop,
|
|||
spa_list_remove (&this->input_link);
|
||||
this->input->node->n_used_input_links--;
|
||||
|
||||
clear_port_buffers (this, this->input);
|
||||
|
||||
if (this->input->node->n_used_input_links == 0 &&
|
||||
this->input->node->n_used_output_links == 0)
|
||||
pinos_node_set_state (this->input->node, PINOS_NODE_STATE_IDLE);
|
||||
|
||||
clear_port_buffers (this, this->input);
|
||||
this->input = NULL;
|
||||
}
|
||||
if (this->output) {
|
||||
spa_list_remove (&this->output_link);
|
||||
this->output->node->n_used_output_links--;
|
||||
|
||||
clear_port_buffers (this, this->output);
|
||||
|
||||
if (this->output->node->n_used_input_links == 0 &&
|
||||
this->output->node->n_used_output_links == 0)
|
||||
pinos_node_set_state (this->output->node, PINOS_NODE_STATE_IDLE);
|
||||
|
||||
clear_port_buffers (this, this->output);
|
||||
this->output = NULL;
|
||||
}
|
||||
if (--impl->refcount == 0)
|
||||
|
|
|
|||
|
|
@ -162,8 +162,10 @@ pause_node (PinosNode *this)
|
|||
SpaResult res;
|
||||
SpaNodeCommand cmd;
|
||||
|
||||
pinos_log_debug ("node %p: pause node", this);
|
||||
if (this->node->state <= SPA_NODE_STATE_PAUSED)
|
||||
return SPA_RESULT_OK;
|
||||
|
||||
pinos_log_debug ("node %p: pause node", this);
|
||||
cmd.type = SPA_NODE_COMMAND_PAUSE;
|
||||
cmd.size = sizeof (cmd);
|
||||
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
||||
|
|
@ -179,7 +181,6 @@ start_node (PinosNode *this)
|
|||
SpaNodeCommand cmd;
|
||||
|
||||
pinos_log_debug ("node %p: start node", this);
|
||||
|
||||
cmd.type = SPA_NODE_COMMAND_START;
|
||||
cmd.size = sizeof (cmd);
|
||||
if ((res = spa_node_send_command (this->node, &cmd)) < 0)
|
||||
|
|
|
|||
|
|
@ -243,11 +243,6 @@ do_remove_link_done (SpaLoop *loop,
|
|||
}
|
||||
}
|
||||
|
||||
if (node->n_used_output_links == 0 &&
|
||||
node->n_used_input_links == 0) {
|
||||
pinos_node_update_state (node, PINOS_NODE_STATE_IDLE, NULL);
|
||||
}
|
||||
|
||||
if (!port->allocated) {
|
||||
pinos_log_debug ("port %p: clear buffers on port", port);
|
||||
spa_node_port_use_buffers (port->node->node,
|
||||
|
|
@ -258,6 +253,11 @@ do_remove_link_done (SpaLoop *loop,
|
|||
port->n_buffers = 0;
|
||||
}
|
||||
|
||||
if (node->n_used_output_links == 0 &&
|
||||
node->n_used_input_links == 0) {
|
||||
pinos_node_update_state (node, PINOS_NODE_STATE_IDLE, NULL);
|
||||
}
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue