From 0a6948ee2008e0ada5ffb89f0640ab9ad8be2001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 20 Feb 2024 11:55:25 +0000 Subject: [PATCH] rtppassthroughpay: fix critical in gst-inspect gst_segment_to_running_time() will fail noisily if the segment has not been initialised yet. Part-of: --- subprojects/gst-plugins-good/docs/gst_plugins_cache.json | 2 +- .../gst-plugins-good/gst/rtp/gstrtppassthroughpay.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json index bf237f2051..823a90a523 100644 --- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json +++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json @@ -15978,7 +15978,7 @@ "construct": false, "construct-only": false, "controllable": false, - "default": "application/x-rtp-payload-stats, clock-rate=(uint)0, running-time=(guint64)18446744073709551615, seqnum=(uint)0, timestamp=(uint)0, ssrc=(uint)0, pt=(uint)128, seqnum-offset=(uint)0, timestamp-offset=(uint)0;", + "default": "application/x-rtp-payload-stats, clock-rate=(uint)0, running-time=(guint64)0, seqnum=(uint)0, timestamp=(uint)0, ssrc=(uint)0, pt=(uint)128, seqnum-offset=(uint)0, timestamp-offset=(uint)0;", "mutable": "null", "readable": true, "type": "GstStructure", diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c index 436f8c003b..2a76c0fdd2 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c @@ -452,8 +452,12 @@ gst_rtp_passthrough_pay_create_stats (GstRtpPassthroughPay * self) { GstClockTime running_time; - running_time = gst_segment_to_running_time (&self->segment, GST_FORMAT_TIME, - self->pts_or_dts); + if (self->segment.format == GST_FORMAT_UNDEFINED) { + running_time = 0; + } else { + running_time = gst_segment_to_running_time (&self->segment, GST_FORMAT_TIME, + self->pts_or_dts); + } return gst_structure_new ("application/x-rtp-payload-stats", "clock-rate", G_TYPE_UINT, (guint) self->clock_rate, "running-time", G_TYPE_UINT64,