rtppassthroughpay: fix critical in gst-inspect
authorTim-Philipp Müller <tim@centricular.com>
Tue, 20 Feb 2024 11:55:25 +0000 (11:55 +0000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 21 Feb 2024 11:25:10 +0000 (11:25 +0000)
gst_segment_to_running_time() will fail noisily
if the segment has not been initialised yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6151>

subprojects/gst-plugins-good/docs/gst_plugins_cache.json
subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c

index bf237f2051b2001859ef46e76c6ca0205382ac22..823a90a5232309990fab5fa87d97c9b8163774db 100644 (file)
                         "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",
index 436f8c003bb4daf58ab7ccc6ed483329b7b789ca..2a76c0fdd2dd8f6a1121b2b4640351d7265ab22e 100644 (file)
@@ -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,