mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: make a new FREEWHEEL clock flag
When freewheeling, the clock is going faster than real time. When freewheeling, skip samples in alsa sink/source.
This commit is contained in:
parent
fab199d5b9
commit
efc497a38a
6 changed files with 22 additions and 2 deletions
|
|
@ -125,6 +125,7 @@ struct spa_io_range {
|
|||
* since the provider was last started.
|
||||
*/
|
||||
struct spa_io_clock {
|
||||
#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0)
|
||||
uint32_t flags; /**< clock flags */
|
||||
uint32_t id; /**< unique clock id, set by application */
|
||||
char name[64]; /**< clock name prefixed with API, set by node. The clock name
|
||||
|
|
|
|||
|
|
@ -640,8 +640,9 @@ static int impl_node_process(void *object)
|
|||
spa_log_trace_fp(this->log, NAME " %p: process %d %d/%d", this, input->status,
|
||||
input->buffer_id,
|
||||
this->n_buffers);
|
||||
|
||||
if (input->status == SPA_STATUS_HAVE_DATA &&
|
||||
if (this->position && this->position->clock.flags & SPA_IO_CLOCK_FLAG_FREEWHEEL) {
|
||||
input->status = SPA_STATUS_NEED_DATA;
|
||||
} else if (input->status == SPA_STATUS_HAVE_DATA &&
|
||||
input->buffer_id < this->n_buffers) {
|
||||
struct buffer *b = &this->buffers[input->buffer_id];
|
||||
|
||||
|
|
|
|||
|
|
@ -666,6 +666,12 @@ 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)
|
||||
spa_alsa_read(this, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue