audioadapter: ask more data when converter empty

When we are actively driving the stream and the converter needs more
data, call the stream process function again to get it so that we
don't underrun.

Fixes #2494
This commit is contained in:
Wim Taymans 2022-07-05 17:54:44 +02:00
parent 987784b629
commit 651f4af0ae
2 changed files with 18 additions and 2 deletions

View file

@ -1153,8 +1153,21 @@ static int follower_ready(void *data, int status)
if (this->target != this->follower) {
this->driver = true;
if (this->direction == SPA_DIRECTION_OUTPUT)
status = spa_node_process(this->convert);
if (this->direction == SPA_DIRECTION_OUTPUT) {
int retry = 8;
while (retry--) {
status = spa_node_process(this->convert);
if (status & SPA_STATUS_HAVE_DATA)
break;
if (status & SPA_STATUS_NEED_DATA) {
status = spa_node_process(this->follower);
if (!(status & SPA_STATUS_HAVE_DATA))
break;
}
}
}
}
return spa_node_call_ready(&this->callbacks, status);

View file

@ -2273,6 +2273,9 @@ static int impl_node_process(void *object)
io->status = -EINVAL;
buf = NULL;
} else {
spa_log_trace_fp(this->log, "%p: input buffer port %d io:%p status:%d id:%d n:%d",
this, port->id, io, io->status, io->buffer_id,
port->n_buffers);
buf = &port->buffers[io->buffer_id];
}