mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
ristrtpdeext: Expose the largest sequence number received
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1153>
This commit is contained in:
parent
f2e8d4dcf2
commit
d9512dc132
2 changed files with 46 additions and 9 deletions
|
@ -47,6 +47,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_rist_rtp_deext_debug);
|
|||
enum
|
||||
{
|
||||
PROP_0 = 0,
|
||||
PROP_MAX_EXT_SEQNUM,
|
||||
PROP_HAVE_EXT_SEQNUM
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
|
@ -67,9 +69,7 @@ struct _GstRistRtpDeext
|
|||
|
||||
GstPad *srcpad, *sinkpad;
|
||||
|
||||
gboolean drop_null;
|
||||
gboolean seqnumext;
|
||||
|
||||
gboolean have_extseqnum;
|
||||
guint32 max_extseqnum;
|
||||
};
|
||||
|
||||
|
@ -151,6 +151,8 @@ gst_rist_rtp_deext_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|||
|
||||
num_packets_deleted = bit_count (npd_bits);
|
||||
|
||||
self->have_extseqnum = has_seqnum_ext;
|
||||
|
||||
if (has_seqnum_ext) {
|
||||
guint16 seqnumext_val = GST_READ_UINT16_BE (data + 2);
|
||||
guint32 extseqnum = seqnumext_val << 16 | gst_rtp_buffer_get_seq (&rtp);
|
||||
|
@ -293,16 +295,21 @@ static void
|
|||
gst_rist_rtp_deext_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstRistRtpDeext *self = GST_RIST_RTP_DEEXT (object); */
|
||||
GstRistRtpDeext *self = GST_RIST_RTP_DEEXT (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_MAX_EXT_SEQNUM:
|
||||
g_value_set_uint (value, self->max_extseqnum);
|
||||
break;
|
||||
case PROP_HAVE_EXT_SEQNUM:
|
||||
g_value_set_boolean (value, self->have_extseqnum);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gst_rist_rtp_deext_class_init (GstRistRtpDeextClass * klass)
|
||||
{
|
||||
|
@ -310,11 +317,23 @@ gst_rist_rtp_deext_class_init (GstRistRtpDeextClass * klass)
|
|||
GObjectClass *object_class = (GObjectClass *) klass;
|
||||
|
||||
gst_element_class_set_metadata (element_class,
|
||||
"RIST RTP Eextension remover", "Filter/Network",
|
||||
"RIST RTP Extension remover", "Filter/Network",
|
||||
"Removes RIST TR-06-2 RTP Header extension",
|
||||
"Olivier Crete <olivier.crete@collabora.com");
|
||||
gst_element_class_add_static_pad_template (element_class, &src_templ);
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_templ);
|
||||
|
||||
object_class->get_property = gst_rist_rtp_deext_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_MAX_EXT_SEQNUM,
|
||||
g_param_spec_uint ("max-ext-seqnum",
|
||||
"Maximum Extended Sequence Number",
|
||||
"Largest extended sequence number received", 0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_HAVE_EXT_SEQNUM,
|
||||
g_param_spec_boolean ("have-ext-seqnum",
|
||||
"Have extended seqnum",
|
||||
"Has an extended sequence number extension been seen", FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
|
|
@ -983,6 +983,7 @@ GST_START_TEST (test_deext_seq_base)
|
|||
GstHarness *h = gst_harness_new ("ristrtpdeext");
|
||||
GstBuffer *ibuf, *obuf;
|
||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||
guint max_seqnum;
|
||||
|
||||
gst_harness_set_src_caps_str (h, "application/x-rtp, payload=33,"
|
||||
"clock-rate=90000, encoding-name=MP2T");
|
||||
|
@ -994,6 +995,9 @@ GST_START_TEST (test_deext_seq_base)
|
|||
gst_rtp_buffer_unmap (&rtp);
|
||||
gst_buffer_unref (obuf);
|
||||
|
||||
g_object_get (h->element, "max-ext-seqnum", &max_seqnum, NULL);
|
||||
fail_unless_equals_int (max_seqnum, 44);
|
||||
|
||||
ibuf = alloc_ts_buffer_with_ext (7, FALSE, TRUE, 7, 188, 0, 1);
|
||||
obuf = gst_harness_push_and_pull (h, ibuf);
|
||||
gst_rtp_buffer_map (obuf, GST_MAP_READ, &rtp);
|
||||
|
@ -1001,6 +1005,9 @@ GST_START_TEST (test_deext_seq_base)
|
|||
gst_rtp_buffer_unmap (&rtp);
|
||||
gst_buffer_unref (obuf);
|
||||
|
||||
g_object_get (h->element, "max-ext-seqnum", &max_seqnum, NULL);
|
||||
fail_unless_equals_int (max_seqnum, 65536 + 44);
|
||||
|
||||
gst_harness_teardown (h);
|
||||
}
|
||||
|
||||
|
@ -1011,6 +1018,7 @@ GST_START_TEST (test_deext_seq_drop)
|
|||
GstHarness *h = gst_harness_new ("ristrtpdeext");
|
||||
GstBuffer *ibuf, *obuf;
|
||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||
guint max_seqnum;
|
||||
|
||||
gst_harness_set_src_caps_str (h, "application/x-rtp, payload=33,"
|
||||
"clock-rate=90000, encoding-name=MP2T");
|
||||
|
@ -1022,6 +1030,10 @@ GST_START_TEST (test_deext_seq_drop)
|
|||
gst_rtp_buffer_unmap (&rtp);
|
||||
gst_buffer_unref (obuf);
|
||||
|
||||
g_object_get (h->element, "max-ext-seqnum", &max_seqnum, NULL);
|
||||
fail_unless_equals_int (max_seqnum, 44);
|
||||
|
||||
|
||||
ibuf = alloc_ts_buffer_with_ext (7, FALSE, TRUE, 7, 188, 0, 2);
|
||||
obuf = gst_harness_push_and_pull (h, ibuf);
|
||||
gst_rtp_buffer_map (obuf, GST_MAP_READ, &rtp);
|
||||
|
@ -1029,10 +1041,16 @@ GST_START_TEST (test_deext_seq_drop)
|
|||
gst_rtp_buffer_unmap (&rtp);
|
||||
gst_buffer_unref (obuf);
|
||||
|
||||
g_object_get (h->element, "max-ext-seqnum", &max_seqnum, NULL);
|
||||
fail_unless_equals_int (max_seqnum, 65536 + 65536 + 44);
|
||||
|
||||
ibuf = alloc_ts_buffer_with_ext (7, FALSE, TRUE, 7, 188, 0, 0);
|
||||
fail_unless_equals_int (gst_harness_push (h, ibuf), GST_FLOW_OK);
|
||||
fail_unless_equals_int (gst_harness_buffers_in_queue (h), 0);
|
||||
|
||||
g_object_get (h->element, "max-ext-seqnum", &max_seqnum, NULL);
|
||||
fail_unless_equals_int (max_seqnum, 65536 + 65536 + 44);
|
||||
|
||||
gst_harness_teardown (h);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue