mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
link: improve state change
Don't assume running state when we already have a format
This commit is contained in:
parent
c315c95e55
commit
6494a5aac0
2 changed files with 10 additions and 10 deletions
|
|
@ -81,12 +81,11 @@ static void pw_link_update_state(struct pw_link *link, enum pw_link_state state,
|
|||
spa_hook_list_call(&link->listener_list, struct pw_link_events,
|
||||
state_changed, old, state, error);
|
||||
|
||||
if (old != PW_LINK_STATE_PAUSED && state == PW_LINK_STATE_PAUSED) {
|
||||
|
||||
pw_log_debug("link %p: %d %d %d %d", link,
|
||||
out->n_ready_output_links, out->n_used_output_links,
|
||||
in->n_ready_input_links, in->n_used_input_links);
|
||||
|
||||
if (old != PW_LINK_STATE_PAUSED && state == PW_LINK_STATE_PAUSED) {
|
||||
if (++out->n_ready_output_links == out->n_used_output_links)
|
||||
pw_node_set_state(out, PW_NODE_STATE_RUNNING);
|
||||
if (++in->n_ready_input_links == in->n_used_input_links)
|
||||
|
|
@ -173,7 +172,6 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
}
|
||||
else {
|
||||
pw_log_debug("link %p: format was already set", this);
|
||||
pw_node_update_state(output->node, PW_NODE_STATE_RUNNING, NULL);
|
||||
changed = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -194,7 +192,6 @@ static int do_negotiate(struct pw_link *this, uint32_t in_state, uint32_t out_st
|
|||
}
|
||||
else {
|
||||
pw_log_debug("link %p: format was already set", this);
|
||||
pw_node_update_state(input->node, PW_NODE_STATE_RUNNING, NULL);
|
||||
changed = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1023,14 +1023,17 @@ int pw_node_set_state(struct pw_node *node, enum pw_node_state state)
|
|||
{
|
||||
int res = 0;
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
enum pw_node_state old = node->info.state;
|
||||
|
||||
if (node->info.state == state)
|
||||
pw_log_debug("node %p: set state %s -> %s", node,
|
||||
pw_node_state_as_string(old),
|
||||
pw_node_state_as_string(state));
|
||||
|
||||
if (old == state)
|
||||
return 0;
|
||||
|
||||
spa_hook_list_call(&node->listener_list, struct pw_node_events, state_request, state);
|
||||
|
||||
pw_log_debug("node %p: set state %s", node, pw_node_state_as_string(state));
|
||||
|
||||
switch (state) {
|
||||
case PW_NODE_STATE_CREATING:
|
||||
return -EIO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue