mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
node: add a clock flag to mark rate/duration inaccurate
Some clocks (v4l2) don't process exactly process buffers at the given rate/duration so mark this in the clock flags. We need to use the nsec field in the clock to derive ticks in pw-stream in that case to get a good clock.
This commit is contained in:
parent
ef8d2ab125
commit
3f0fe0032f
2 changed files with 9 additions and 1 deletions
|
|
@ -638,7 +638,12 @@ static inline void copy_position(struct stream *impl, int64_t queued)
|
|||
impl->base_pos = p->clock.position - impl->time.ticks;
|
||||
impl->clock_id = p->clock.id;
|
||||
}
|
||||
impl->time.ticks = p->clock.position - impl->base_pos;
|
||||
if (SPA_FLAG_IS_SET(p->clock.flags, SPA_IO_CLOCK_FLAG_NO_RATE))
|
||||
impl->time.ticks = p->clock.nsec * p->clock.rate.denom /
|
||||
(SPA_NSEC_PER_SEC * p->clock.rate.num);
|
||||
else
|
||||
impl->time.ticks = p->clock.position - impl->base_pos;
|
||||
|
||||
impl->time.delay = 0;
|
||||
impl->time.queued = queued;
|
||||
impl->quantum = p->clock.duration;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue