From: Piotr BrzeziƄski Date: Wed, 18 Sep 2024 10:34:39 +0000 (+0200) Subject: rtppassthroughpay: Fix reading clock-rate and payload type from caps X-Git-Tag: 1.24.9~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=084950dd9e14a44423d965b7128b858e6b1eaae6;p=platform%2Fupstream%2Fgstreamer.git rtppassthroughpay: Fix reading clock-rate and payload type from caps They were using wrong types - while uint is correct technically, for compatibility reasons caps have them as signed int. Values are now correctly read + added simple guards just to be sure. Part-of: --- diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json index 03a0476aff..21b6341b8a 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)0, 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=(int)0, running-time=(guint64)0, seqnum=(uint)0, timestamp=(uint)0, ssrc=(uint)0, pt=(int)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 2a76c0fdd2..8fdee09018 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.c @@ -411,8 +411,12 @@ gst_rtp_passthrough_pay_sink_event (GstPad * pad, s = gst_caps_get_structure (caps, 0); - gst_structure_get_uint (s, "payload", &self->pt); - gst_structure_get_uint (s, "clock-rate", &self->clock_rate); + if (!self->pt_override + && !gst_structure_get_int (s, "payload", &self->pt)) { + GST_WARNING_OBJECT (self, "Caps are missing payload type!"); + } + if (!gst_structure_get_int (s, "clock-rate", &self->clock_rate)) + GST_WARNING_OBJECT (self, "Caps are missing clock-rate!"); if (gst_structure_get_uint (s, "ssrc", &self->ssrc)) self->ssrc_set = TRUE; if (gst_structure_get_uint (s, "clock-base", &self->timestamp_offset)) @@ -460,10 +464,10 @@ gst_rtp_passthrough_pay_create_stats (GstRtpPassthroughPay * self) } return gst_structure_new ("application/x-rtp-payload-stats", "clock-rate", - G_TYPE_UINT, (guint) self->clock_rate, "running-time", G_TYPE_UINT64, + G_TYPE_INT, self->clock_rate, "running-time", G_TYPE_UINT64, running_time, "seqnum", G_TYPE_UINT, (guint) self->seqnum, "timestamp", G_TYPE_UINT, (guint) self->timestamp, "ssrc", G_TYPE_UINT, self->ssrc, - "pt", G_TYPE_UINT, self->pt, "seqnum-offset", G_TYPE_UINT, + "pt", G_TYPE_INT, self->pt, "seqnum-offset", G_TYPE_UINT, (guint) self->seqnum_offset, "timestamp-offset", G_TYPE_UINT, (guint) self->timestamp_offset, NULL); diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.h b/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.h index 9191e35b89..68536821d7 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.h +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.h @@ -53,8 +53,8 @@ struct _GstRtpPassthroughPay GstCaps *caps; GstSegment segment; - guint clock_rate; - guint pt; + gint clock_rate; + gint pt; gboolean pt_override; guint ssrc; gboolean ssrc_set;