mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node-driver: fix position calculation
Set the driver node position based on the current time when we start and keep incrementing it with the previous duration.
This commit is contained in:
parent
5ea3c10dca
commit
78b8e1af57
1 changed files with 5 additions and 6 deletions
|
|
@ -263,15 +263,14 @@ static void on_timeout(struct spa_source *source)
|
|||
|
||||
current_position = scale_u64(current_time, rate, SPA_NSEC_PER_SEC);
|
||||
|
||||
if (SPA_LIKELY(this->clock))
|
||||
position = this->clock->position;
|
||||
else
|
||||
position = current_position;
|
||||
|
||||
if (this->last_time == 0) {
|
||||
spa_dll_set_bw(&this->dll, SPA_DLL_BW_MIN, duration, rate);
|
||||
this->max_error = rate * MAX_ERROR_MS / 1000;
|
||||
position = current_position;
|
||||
} else if (SPA_LIKELY(this->clock)) {
|
||||
position = this->clock->position + this->clock->duration;
|
||||
} else {
|
||||
position = current_position;
|
||||
}
|
||||
|
||||
/* check the elapsed time of the other clock against
|
||||
|
|
@ -304,7 +303,7 @@ static void on_timeout(struct spa_source *source)
|
|||
if (SPA_LIKELY(this->clock)) {
|
||||
this->clock->nsec = nsec;
|
||||
this->clock->rate = this->clock->target_rate;
|
||||
this->clock->position += this->clock->duration;
|
||||
this->clock->position = position;
|
||||
this->clock->duration = duration;
|
||||
this->clock->delay = 0;
|
||||
this->clock->rate_diff = corr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue