audioadapter: improve state check

Update the started and ready state after we suspend/pause the node so
that we don't complain if scheduling happens between setting the fields
and actually stopping the follower.

Also only complain when the scheduling happens when the node is not
ready. It is possible that the node is scheduled before we manage to set
the started field.
This commit is contained in:
Wim Taymans 2023-12-13 12:26:26 +01:00
parent 27bed62e66
commit ad784ca5e6

View file

@ -927,15 +927,9 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
this->warned = false; this->warned = false;
break; break;
case SPA_NODE_COMMAND_Suspend: case SPA_NODE_COMMAND_Suspend:
this->started = false;
this->ready = false;
this->warned = 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;
this->ready = false;
this->warned = 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:
@ -972,9 +966,15 @@ 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);
this->started = false;
this->warned = false;
this->ready = false;
spa_log_debug(this->log, "%p: suspended", this); spa_log_debug(this->log, "%p: suspended", this);
break; break;
case SPA_NODE_COMMAND_Pause: case SPA_NODE_COMMAND_Pause:
this->started = false;
this->warned = false;
this->ready = false;
spa_log_debug(this->log, "%p: paused", this); spa_log_debug(this->log, "%p: paused", this);
break; break;
case SPA_NODE_COMMAND_Flush: case SPA_NODE_COMMAND_Flush:
@ -1572,7 +1572,7 @@ static int impl_node_process(void *object)
struct impl *this = object; struct impl *this = object;
int status = 0, fstatus, retry = 8; int status = 0, fstatus, retry = 8;
if (!this->started) { if (!this->ready) {
if (!this->warned) if (!this->warned)
spa_log_warn(this->log, "%p: scheduling stopped node", this); spa_log_warn(this->log, "%p: scheduling stopped node", this);
this->warned = true; this->warned = true;