stream: implement Flush

Flush out pending samples in the resampler
Set the io area status to _OK so that buffers are recycled and
new buffers produced.
This commit is contained in:
Wim Taymans 2020-11-17 17:15:26 +01:00
parent cd25a1e5e7
commit 79fb95bf90
8 changed files with 36 additions and 6 deletions

View file

@ -248,6 +248,17 @@ static void update_rate_match(struct impl *this)
}
}
static void reset_node(struct impl *this)
{
struct port *outport, *inport;
outport = GET_OUT_PORT(this, 0);
inport = GET_IN_PORT(this, 0);
resample_reset(&this->resample);
outport->offset = 0;
inport->offset = 0;
}
static int impl_node_send_command(void *object, const struct spa_command *command)
{
struct impl *this = object;
@ -262,9 +273,10 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
update_rate_match(this);
break;
case SPA_NODE_COMMAND_Suspend:
SPA_FALLTHROUGH
case SPA_NODE_COMMAND_Flush:
reset_node(this);
SPA_FALLTHROUGH;
case SPA_NODE_COMMAND_Pause:
resample_reset(&this->resample);
this->started = false;
break;
default: