From 131d59518eec898007b8ccee6bf0b089dbb44a83 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Mon, 15 May 2023 19:10:39 +1000 Subject: [PATCH] splitmuxsrc: Make PTS contiguous by preference Make splitmuxsrc deal better with stream reordering by making the largest observed PTS contiguous in the next fragment. Previously, it selected DTS, but then aligned that with the segment start of the next fragment, which holds PTS values - leading to glitches in streams that don't have PTS = DTS at the start. Part-of: --- .../gst/multifile/gstsplitmuxpartreader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c index b38d4b95be..b7d79fb6a7 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxpartreader.c @@ -158,12 +158,12 @@ handle_buffer_measuring (GstSplitMuxPartReader * reader, * not to generate output timestamps */ /* Update the stored max duration on the pad, - * always preferring making DTS contiguous + * always preferring making reordered PTS contiguous * where possible */ - if (GST_BUFFER_DTS_IS_VALID (buf)) - ts = GST_BUFFER_DTS (buf) + offset; - else if (GST_BUFFER_PTS_IS_VALID (buf)) + if (GST_BUFFER_PTS_IS_VALID (buf)) ts = GST_BUFFER_PTS (buf) + offset; + else if (GST_BUFFER_DTS_IS_VALID (buf)) + ts = GST_BUFFER_DTS (buf) + offset; GST_DEBUG_OBJECT (reader, "Pad %" GST_PTR_FORMAT " incoming DTS %" GST_TIME_FORMAT