mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
node: set state before calling into methods
This commit is contained in:
parent
2fe7197930
commit
8ff7a5fa29
1 changed files with 16 additions and 10 deletions
|
|
@ -50,13 +50,11 @@ struct resource_data {
|
||||||
|
|
||||||
/** \endcond */
|
/** \endcond */
|
||||||
|
|
||||||
static int pause_node(struct pw_node *this)
|
|
||||||
|
static int do_pause_node(struct pw_node *this)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (this->info.state <= PW_NODE_STATE_IDLE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
pw_log_debug("node %p: pause node", this);
|
pw_log_debug("node %p: pause node", this);
|
||||||
res = spa_node_send_command(this->node,
|
res = spa_node_send_command(this->node,
|
||||||
&SPA_COMMAND_INIT(this->core->type.command_node.Pause));
|
&SPA_COMMAND_INIT(this->core->type.command_node.Pause));
|
||||||
|
|
@ -66,6 +64,14 @@ static int pause_node(struct pw_node *this)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pause_node(struct pw_node *this)
|
||||||
|
{
|
||||||
|
if (this->info.state <= PW_NODE_STATE_IDLE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return do_pause_node(this);
|
||||||
|
}
|
||||||
|
|
||||||
static int start_node(struct pw_node *this)
|
static int start_node(struct pw_node *this)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
@ -911,17 +917,17 @@ void pw_node_update_state(struct pw_node *node, enum pw_node_state state, char *
|
||||||
pw_log_debug("node %p: update state from %s -> %s", node,
|
pw_log_debug("node %p: update state from %s -> %s", node,
|
||||||
pw_node_state_as_string(old), pw_node_state_as_string(state));
|
pw_node_state_as_string(old), pw_node_state_as_string(state));
|
||||||
|
|
||||||
if (state == PW_NODE_STATE_IDLE) {
|
|
||||||
if (impl->pause_on_idle)
|
|
||||||
pause_node(node);
|
|
||||||
node_deactivate(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node->info.error)
|
if (node->info.error)
|
||||||
free((char*)node->info.error);
|
free((char*)node->info.error);
|
||||||
node->info.error = error;
|
node->info.error = error;
|
||||||
node->info.state = state;
|
node->info.state = state;
|
||||||
|
|
||||||
|
if (state == PW_NODE_STATE_IDLE) {
|
||||||
|
if (impl->pause_on_idle)
|
||||||
|
do_pause_node(node);
|
||||||
|
node_deactivate(node);
|
||||||
|
}
|
||||||
|
|
||||||
spa_hook_list_call(&node->listener_list, struct pw_node_events, state_changed,
|
spa_hook_list_call(&node->listener_list, struct pw_node_events, state_changed,
|
||||||
old, state, error);
|
old, state, error);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue