audioadapter: clear started flag earlier

First clear the started flag so that we ignore scheduling from the
follower. Then stop the follower and the converter.

This is the sequence we follow when deactivating a node, so do the
same here.

it is important that the node is not scheduled anymore when we clear
the format in suspend or else we might crash.

See #2877
This commit is contained in:
Wim Taymans 2022-12-07 13:12:18 +01:00
parent 3e000c11c4
commit cf3d4c3b5d

View file

@ -852,9 +852,11 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->started = true; this->started = true;
break; break;
case SPA_NODE_COMMAND_Suspend: case SPA_NODE_COMMAND_Suspend:
this->started = false;
spa_log_debug(this->log, "%p: suspending", this); spa_log_debug(this->log, "%p: suspending", this);
break; break;
case SPA_NODE_COMMAND_Pause: case SPA_NODE_COMMAND_Pause:
this->started = false;
spa_log_debug(this->log, "%p: pausing", this); spa_log_debug(this->log, "%p: pausing", this);
break; break;
case SPA_NODE_COMMAND_Flush: case SPA_NODE_COMMAND_Flush:
@ -886,10 +888,10 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
break; break;
case SPA_NODE_COMMAND_Suspend: case SPA_NODE_COMMAND_Suspend:
configure_format(this, 0, NULL); configure_format(this, 0, NULL);
SPA_FALLTHROUGH spa_log_debug(this->log, "%p: suspended", this);
break;
case SPA_NODE_COMMAND_Pause: case SPA_NODE_COMMAND_Pause:
this->started = false; spa_log_debug(this->log, "%p: paused", this);
spa_log_debug(this->log, "%p: stopped", this);
break; break;
case SPA_NODE_COMMAND_Flush: case SPA_NODE_COMMAND_Flush:
spa_log_debug(this->log, "%p: flushed", this); spa_log_debug(this->log, "%p: flushed", this);