mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
support: sync timers with data loop
Start and stop the timers in the data_loop. Otherwise we might be trying to stop a timer while the data loop is starting it and we end up with "ready non-active node" messages.
This commit is contained in:
parent
157a97cc98
commit
5ea3c10dca
2 changed files with 10 additions and 10 deletions
|
|
@ -191,7 +191,7 @@ static int set_timers(struct impl *this)
|
|||
return res;
|
||||
this->next_time = SPA_TIMESPEC_TO_NSEC(&now);
|
||||
|
||||
if (this->following) {
|
||||
if (this->following || !this->started) {
|
||||
set_timeout(this, 0);
|
||||
} else {
|
||||
set_timeout(this, this->next_time);
|
||||
|
|
@ -204,7 +204,7 @@ static inline bool is_following(struct impl *this)
|
|||
return this->position && this->clock && this->position->clock.id != this->clock->id;
|
||||
}
|
||||
|
||||
static int do_reassign_follower(struct spa_loop *loop,
|
||||
static int do_set_timers(struct spa_loop *loop,
|
||||
bool async,
|
||||
uint32_t seq,
|
||||
const void *data,
|
||||
|
|
@ -227,7 +227,7 @@ static int reassign_follower(struct impl *this)
|
|||
if (following != this->following) {
|
||||
spa_log_debug(this->log, NAME" %p: reassign follower %d->%d", this, this->following, following);
|
||||
this->following = following;
|
||||
spa_loop_invoke(this->data_loop, do_reassign_follower, 0, NULL, 0, true, this);
|
||||
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -310,8 +310,8 @@ static int do_start(struct impl *this)
|
|||
return 0;
|
||||
|
||||
this->following = is_following(this);
|
||||
set_timers(this);
|
||||
this->started = true;
|
||||
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ static int do_stop(struct impl *this)
|
|||
if (!this->started)
|
||||
return 0;
|
||||
this->started = false;
|
||||
set_timeout(this, 0);
|
||||
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue