gst/pipewiresrc: Improve base_time handling

It can not generically assumed that the gstreamer clock (and therefore
the base_time) is based on CLOCK_MONOTONIC.

It was tried to use the logic provided by
GstBaseSrc::gst_base_src_do_sync() in commit 004206db37
("gst/pipewiresrc: Let GstBaseSrc handle pseudo-live calculations").
This has the downside, that a potential jitter on the first buffer is
included in the calculated time offset. In gstreamer pipelines with
multiple pipewiresrc elements and big jitter on the first buffer the
streams will stay out of sync.

Improve that by checking if the gstreamer clock is provided by pipewire
and therefore known to be CLOCK_MONOTONIC or if it is provided by
gstreamer and we need to manually calculate the base_time.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
Stefan Klug 2026-04-14 16:14:06 +02:00
parent 6ac9677b35
commit 9e52e7ee7f
2 changed files with 23 additions and 7 deletions

View file

@ -79,6 +79,7 @@ struct _GstPipeWireSrc {
gboolean is_live;
int64_t delay;
uint64_t pw_base_time;
GstClockTime min_latency;
GstClockTime max_latency;