diff --git a/gst/rist/gstristrtpdeext.c b/gst/rist/gstristrtpdeext.c index 982b66a6e0..47d3c2bfef 100644 --- a/gst/rist/gstristrtpdeext.c +++ b/gst/rist/gstristrtpdeext.c @@ -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 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)); } diff --git a/tests/check/elements/ristrtpext.c b/tests/check/elements/ristrtpext.c index 69e067bffb..b9648f68bc 100644 --- a/tests/check/elements/ristrtpext.c +++ b/tests/check/elements/ristrtpext.c @@ -131,9 +131,9 @@ validate_ext (GstRTPBuffer * rtp, gboolean wanted_has_drop_null, data = extdata; - has_drop_null = (data[0] >> 7) & 1; /* N */ - has_seqnum_ext = (data[0] >> 6) & 1; /* E */ - orig_ts_packet_count = (data[0] >> 3) & 7; /* Size */ + has_drop_null = (data[0] >> 7) & 1; /* N */ + has_seqnum_ext = (data[0] >> 6) & 1; /* E */ + orig_ts_packet_count = (data[0] >> 3) & 7; /* Size */ ts_packet_size = ((data[1] >> 7) & 1) ? 204 : 188; npd_bits = data[1] & 0x7F; @@ -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); }