mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-07-21 18:26:24 +00:00
audioconvert: update started field better
Set up the adapter and then set the started field to true before we Start the follower and converter. It is possible that the follower will start processing immediately so the started state needs to be set correctly. Similarly, first perform the Pause and Suspend calls on the follower and converter before clearing our buffers and format so that things are stopped properly. See #2764
This commit is contained in:
parent
122252ce52
commit
855bebf0ea
|
@ -814,21 +814,23 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
|||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
spa_log_debug(this->log, "%p: starting %d", this, this->started);
|
||||
if (this->started)
|
||||
return 0;
|
||||
if ((res = negotiate_format(this)) < 0)
|
||||
return res;
|
||||
if ((res = negotiate_buffers(this)) < 0)
|
||||
return res;
|
||||
this->started = true;
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
configure_format(this, 0, NULL);
|
||||
SPA_FALLTHROUGH
|
||||
spa_log_debug(this->log, "%p: suspending", this);
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Pause:
|
||||
this->started = false;
|
||||
spa_log_debug(this->log, "%p: stopped", this);
|
||||
spa_log_debug(this->log, "%p: pausing", this);
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Flush:
|
||||
spa_log_debug(this->log, "%p: flushing", this);
|
||||
this->io_buffers.status = SPA_STATUS_OK;
|
||||
break;
|
||||
default:
|
||||
|
@ -852,9 +854,18 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
|||
}
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
this->started = true;
|
||||
spa_log_debug(this->log, "%p: started", this);
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
configure_format(this, 0, NULL);
|
||||
SPA_FALLTHROUGH
|
||||
case SPA_NODE_COMMAND_Pause:
|
||||
this->started = false;
|
||||
spa_log_debug(this->log, "%p: stopped", this);
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Flush:
|
||||
spa_log_debug(this->log, "%p: flushed", this);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue