diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2023-04-27 16:29:53 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2023-04-30 15:16:00 +0100 |
commit | 35322de964118da3ee5a6bf45a204b41d20a7233 (patch) | |
tree | e2bac660ecfe19f44af71478a67bd99dd3d6022f | |
parent | 0e8b726843fe232f35cacf64a45f41de9c46e533 (diff) | |
download | gstreamer-35322de964118da3ee5a6bf45a204b41d20a7233.tar.gz |
splitmuxsink: Catch invalid DTS to avoid running into problems later
DTS > PTS makes no sense, so we clamp DTS to the PTS. Also if there's a
PTS but no DTS, then assume that PTS=DTS to make sure we're not working
with a much older DTS.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4515>
-rw-r--r-- | subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index ad6c3d3782..0d661854ad 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -2947,10 +2947,16 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) else running_time_pts = GST_CLOCK_STIME_NONE; - if (GST_CLOCK_TIME_IS_VALID (dts)) + if (GST_CLOCK_TIME_IS_VALID (dts)) { running_time_dts = my_segment_to_running_time (&ctx->in_segment, dts); - else - running_time_dts = GST_CLOCK_STIME_NONE; + + /* DTS > PTS makes conceptually no sense so catch such invalid DTS here + * by clamping to the PTS */ + running_time_dts = MIN (running_time_pts, running_time_dts); + } else { + /* If there is no DTS then assume PTS=DTS */ + running_time_dts = running_time_pts; + } /* Try to make sure we have a valid running time */ if (!GST_CLOCK_STIME_IS_VALID (ctx->in_running_time)) { |