alsa: pause/resume when entering/exiting freewheel

When we start freewheeling, pause the device and resume when we
finish freewheel.
In freewheel mode, just discard samples in the sink and produce
silence in the source.
This commit is contained in:
Wim Taymans 2021-05-07 11:51:22 +02:00
parent a80ec36ad5
commit 02decd9fba
4 changed files with 62 additions and 16 deletions

View file

@ -666,16 +666,13 @@ static int impl_node_process(void *object)
spa_alsa_recycle_buffer(this, io->buffer_id);
io->buffer_id = SPA_ID_INVALID;
}
if (this->position && this->position->clock.flags & SPA_IO_CLOCK_FLAG_FREEWHEEL) {
spa_log_info(this->log, NAME " %p:freewheel", this);
io->status = SPA_STATUS_HAVE_DATA;
io->buffer_id = 0;
return SPA_STATUS_HAVE_DATA;
if (spa_list_is_empty(&this->ready) && this->following) {
if (this->freewheel)
spa_alsa_skip(this);
else
spa_alsa_read(this);
}
if (spa_list_is_empty(&this->ready) && this->following)
spa_alsa_read(this, 0);
if (spa_list_is_empty(&this->ready) || !this->following)
return SPA_STATUS_OK;