mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
plugins: simplify target_ handling
Drivers should only read the target_ values in the timeout, update the timeout with the new duration and then update the position. For the position we simply need to add the previous duration to the position and then set the new duration + rate. Otherwise, everything else should read the duration/rate and not use the target_ values.
This commit is contained in:
parent
f309543810
commit
7b6680ba57
13 changed files with 132 additions and 154 deletions
|
|
@ -989,11 +989,8 @@ static void media_on_timeout(struct spa_source *source)
|
|||
now_time, now_time - prev_time);
|
||||
|
||||
if (SPA_LIKELY(this->position)) {
|
||||
this->position->clock.duration = this->position->clock.target_duration;
|
||||
this->position->clock.rate = this->position->clock.target_rate;
|
||||
|
||||
duration = this->position->clock.duration;
|
||||
rate = this->position->clock.rate.denom;
|
||||
duration = this->position->clock.target_duration;
|
||||
rate = this->position->clock.target_rate.denom;
|
||||
} else {
|
||||
duration = 1024;
|
||||
rate = 48000;
|
||||
|
|
@ -1005,7 +1002,8 @@ static void media_on_timeout(struct spa_source *source)
|
|||
int64_t delay_nsec = 0;
|
||||
|
||||
this->clock->nsec = now_time;
|
||||
this->clock->position += duration;
|
||||
this->clock->rate = this->clock->target_rate;
|
||||
this->clock->position += this->clock->duration;
|
||||
this->clock->duration = duration;
|
||||
this->clock->rate_diff = 1.0f;
|
||||
this->clock->next_nsec = this->next_time;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue