mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
impl-node: improve suspend
Make sure we can only suspend when the node is (going to) IDLE. We don't really want to allow applications to suspend a node that is running or starting up. This might fix a race when a node is suspended at the same time it is started and cause silence. It also fixes the issue of total silence when doing "pactl suspend <node> 1" on a running node. See #3378
This commit is contained in:
parent
6ad0eb533d
commit
3b052eaa99
1 changed files with 4 additions and 1 deletions
|
|
@ -591,6 +591,7 @@ static int node_send_command(void *object, const struct spa_command *command)
|
|||
{
|
||||
struct resource_data *data = object;
|
||||
struct pw_impl_node *node = data->node;
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
uint32_t id = SPA_NODE_COMMAND_ID(command);
|
||||
|
||||
pw_log_debug("%p: got command %d (%s)", node, id,
|
||||
|
|
@ -598,7 +599,9 @@ static int node_send_command(void *object, const struct spa_command *command)
|
|||
|
||||
switch (id) {
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
suspend_node(node);
|
||||
if (node->info.state == PW_NODE_STATE_ERROR ||
|
||||
impl->pending_state == PW_NODE_STATE_IDLE)
|
||||
suspend_node(node);
|
||||
break;
|
||||
default:
|
||||
spa_node_send_command(node->node, command);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue