diff --git a/spa/include/spa/node/io.h b/spa/include/spa/node/io.h index a0a2c90f7..d9e7de075 100644 --- a/spa/include/spa/node/io.h +++ b/spa/include/spa/node/io.h @@ -125,7 +125,8 @@ struct spa_io_range { * \ref spa_io_position.clock.id in \ref SPA_IO_Position are the same. */ struct spa_io_clock { -#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0) +#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0) /* graph is freewheeling */ +#define SPA_IO_CLOCK_FLAG_XRUN_RECOVER (1u<<1) /* recovering from xrun */ uint32_t flags; /**< Clock flags */ uint32_t id; /**< Unique clock id, set by host application */ char name[64]; /**< Clock name prefixed with API, set by node when it receives diff --git a/spa/plugins/support/node-driver.c b/spa/plugins/support/node-driver.c index 468e9ab7d..4b94fd79d 100644 --- a/spa/plugins/support/node-driver.c +++ b/spa/plugins/support/node-driver.c @@ -524,7 +524,8 @@ static int impl_node_process(void *object) spa_return_val_if_fail(this != NULL, -EINVAL); spa_log_trace(this->log, "process %d", this->props.freewheel); - if (this->props.freewheel) { + if (this->props.freewheel && + !SPA_FLAG_IS_SET(this->position->clock.flags, SPA_IO_CLOCK_FLAG_XRUN_RECOVER)) { this->next_time = gettime_nsec(this, this->timer_clockid); set_timeout(this, this->next_time); } diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index be25aa83e..5845aa71c 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -2034,7 +2034,9 @@ static int node_ready(void *data, int status) old_status = SPA_ATOMIC_LOAD(a->status); if (old_status != PW_NODE_ACTIVATION_FINISHED) { SPA_ATOMIC_STORE(a->status, PW_NODE_ACTIVATION_TRIGGERED); + SPA_FLAG_SET(cl->flags, SPA_IO_CLOCK_FLAG_XRUN_RECOVER); process_node(node, nsec); + SPA_FLAG_CLEAR(cl->flags, SPA_IO_CLOCK_FLAG_XRUN_RECOVER); debug_xrun_graph(node, nsec); } }