mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-12 03:01:58 -04:00
node-driver: report discontinuity flag when resyncing position
module-rtp-sink is sending data timestampted with clock provided from a driver. When driver jumps (for example due ptp master change) rtp sink has to jumps too. Rtp sink is checking for difference between expected and actual position and is big enough the jump is done. As resync value in driver is not equal to diff between positions, sink could ends with not precise timestamps up to 1 quantum. Emit discont flag when driver jumps, so sink can be reinitialized without its own heuristic.
This commit is contained in:
parent
0550537ce0
commit
0a8ddba3e9
1 changed files with 4 additions and 1 deletions
|
|
@ -363,6 +363,7 @@ static void on_timeout(struct spa_source *source)
|
|||
double corr = 1.0, err = 0.0, abs_err = 0.0;
|
||||
int res;
|
||||
bool timer_was_canceled = false;
|
||||
bool report_discont = false;
|
||||
|
||||
/* See set_timeout() for an explanation about timer cancelation. */
|
||||
|
||||
|
|
@ -380,6 +381,7 @@ static void on_timeout(struct spa_source *source)
|
|||
return;
|
||||
}
|
||||
}
|
||||
report_discont = timer_was_canceled;
|
||||
|
||||
if (SPA_LIKELY(this->position)) {
|
||||
duration = this->position->clock.target_duration;
|
||||
|
|
@ -487,6 +489,7 @@ static void on_timeout(struct spa_source *source)
|
|||
spa_dll_set_bw(&this->dll, SPA_DLL_BW_MAX, duration, rate);
|
||||
position = current_position;
|
||||
err = 0.0;
|
||||
report_discont = true;
|
||||
} else {
|
||||
err = SPA_CLAMPD(err, -this->max_error, this->max_error);
|
||||
}
|
||||
|
|
@ -519,7 +522,7 @@ static void on_timeout(struct spa_source *source)
|
|||
this->clock->next_nsec = this->next_time + nsec_offset;
|
||||
|
||||
SPA_FLAG_UPDATE(this->clock->flags, SPA_IO_CLOCK_FLAG_DISCONT,
|
||||
timer_was_canceled);
|
||||
report_discont);
|
||||
}
|
||||
|
||||
spa_node_call_ready(&this->callbacks,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue