diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2019-07-23 17:27:06 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2020-04-30 18:31:31 +0000 |
commit | 59b01048ae67739cef60b834390ae14dd59386f9 (patch) | |
tree | db98cf0a4949f39f9cc9efd36712746395bd0522 /gst/rist | |
parent | fa5d206c2c101cc036cd1ac6cc15449a7ee7f64a (diff) | |
download | gstreamer-plugins-bad-59b01048ae67739cef60b834390ae14dd59386f9.tar.gz |
rist: Drop packets that are more than G_MAXINT16 seqnum late
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
Diffstat (limited to 'gst/rist')
-rw-r--r-- | gst/rist/gstristrtpdeext.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gst/rist/gstristrtpdeext.c b/gst/rist/gstristrtpdeext.c index 097d203f6..5c262560b 100644 --- a/gst/rist/gstristrtpdeext.c +++ b/gst/rist/gstristrtpdeext.c @@ -69,6 +69,8 @@ struct _GstRistRtpDeext gboolean drop_null; gboolean seqnumext; + + guint32 max_extseqnum; }; G_DEFINE_TYPE_WITH_CODE (GstRistRtpDeext, gst_rist_rtp_deext, GST_TYPE_ELEMENT, @@ -138,6 +140,24 @@ gst_rist_rtp_deext_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) GST_LOG_OBJECT (self, "Seqnum ext is %d\n", seqnumext_val); } else if (has_seqnum_ext && extlen == 0) { GST_WARNING_OBJECT (self, "Has seqnum flag, but extension is too short"); + has_seqnum_ext = FALSE; + seqnumext_val = 0; + } + + if (has_seqnum_ext) { + guint32 extseqnum = seqnumext_val << 16 | gst_rtp_buffer_get_seq (&rtp); + + if (extseqnum < self->max_extseqnum && + self->max_extseqnum - extseqnum > G_MAXINT16) { + gst_rtp_buffer_unmap (&rtp); + gst_buffer_unref (buffer); + GST_WARNING_OBJECT (self, "Buffer with extended seqnum %u is more than" + " G_MAXINT16 (%u) before the higher received seqnum %u, dropping to" + " avoid confusing downstream elements.", + extseqnum, G_MAXINT16, self->max_extseqnum); + return GST_FLOW_OK; + } + self->max_extseqnum = MAX (self->max_extseqnum, extseqnum); } if (!has_drop_null || num_packets_deleted == 0) |