mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
node: update the duration/rate from the target
Before scheduling the graph from the driver, update the duration and rate with the new targets.
This commit is contained in:
parent
1bdd5eee69
commit
6e8625cf96
13 changed files with 87 additions and 3 deletions
|
|
@ -989,6 +989,9 @@ 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;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -612,6 +612,9 @@ 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;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -838,6 +838,14 @@ static int process_input(struct impl *this)
|
|||
return SPA_STATUS_HAVE_DATA;
|
||||
}
|
||||
|
||||
static void update_target(struct impl *this)
|
||||
{
|
||||
if (SPA_LIKELY(this->position)) {
|
||||
this->position->clock.duration = this->position->clock.target_duration;
|
||||
this->position->clock.rate = this->position->clock.target_rate;
|
||||
}
|
||||
}
|
||||
|
||||
static void update_position(struct impl *this)
|
||||
{
|
||||
if (SPA_LIKELY(this->position)) {
|
||||
|
|
@ -868,6 +876,8 @@ static void on_timeout(struct spa_source *source)
|
|||
spa_log_trace(this->log, "%p: timer %"PRIu64" %"PRIu64"", this,
|
||||
now_time, now_time - prev_time);
|
||||
|
||||
update_target(this);
|
||||
|
||||
update_position(this);
|
||||
|
||||
this->next_time = now_time + this->duration * SPA_NSEC_PER_SEC / this->rate;
|
||||
|
|
@ -1161,6 +1171,9 @@ static int do_start(struct impl *this)
|
|||
|
||||
this->following = is_following(this);
|
||||
|
||||
if (!this->following)
|
||||
update_target(this);
|
||||
|
||||
update_position(this);
|
||||
|
||||
spa_log_debug(this->log, "%p: start following:%d",
|
||||
|
|
|
|||
|
|
@ -603,6 +603,9 @@ static void sco_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;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -611,6 +611,9 @@ static void sco_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;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue