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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7526>
This commit is contained in:
Piotr Brzeziński 2024-09-18 12:34:39 +02:00 committed by GStreamer Marge Bot
parent 363154d855
commit a6fa53b7b1
3 changed files with 11 additions and 7 deletions

View file

@ -16344,7 +16344,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",

View file

@ -502,8 +502,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))
@ -551,10 +555,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);

View file

@ -66,8 +66,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;