From e43bbaf3d97d0d85d01371fec68ae25f64aba393 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 31 Aug 2021 15:31:23 +1000 Subject: [PATCH] rtp: add some additional rtcp sdes values Matches the current list at https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-5 as of 2021-September. Part-of: --- gst-libs/gst/rtp/gstrtcpbuffer.c | 42 ++++++++++++++++++++++ gst-libs/gst/rtp/gstrtcpbuffer.h | 76 ++++++++++++++++++++++++++++++++++------ tests/check/libs/rtp.c | 20 +++++++++++ 3 files changed, 128 insertions(+), 10 deletions(-) diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c index 876c4a9..5b58207 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.c +++ b/gst-libs/gst/rtp/gstrtcpbuffer.c @@ -2211,6 +2211,27 @@ gst_rtcp_sdes_type_to_name (GstRTCPSDESType type) case GST_RTCP_SDES_PRIV: result = "priv"; break; + case GST_RTCP_SDES_H323_CADDR: + result = "h323-caddr"; + break; + case GST_RTCP_SDES_APSI: + result = "apsi"; + break; + case GST_RTCP_SDES_RGRP: + result = "rgrp"; + break; + case GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID: + result = "repaired-rtp-stream-id"; + break; + case GST_RTCP_SDES_CCID: + result = "ccid"; + break; + case GST_RTCP_SDES_RTP_STREAM_ID: + result = "rtp-stream-id"; + break; + case GST_RTCP_SDES_MID: + result = "mid"; + break; default: result = NULL; break; @@ -2255,6 +2276,27 @@ gst_rtcp_sdes_name_to_type (const gchar * name) if (strcmp ("note", name) == 0) return GST_RTCP_SDES_NOTE; + if (strcmp ("h323-caddr", name) == 0) + return GST_RTCP_SDES_H323_CADDR; + + if (strcmp ("apsi", name) == 0) + return GST_RTCP_SDES_APSI; + + if (strcmp ("rgrp", name) == 0) + return GST_RTCP_SDES_RGRP; + + if (strcmp ("rtp-stream-id", name) == 0) + return GST_RTCP_SDES_RTP_STREAM_ID; + + if (strcmp ("repaired-rtp-stream-id", name) == 0) + return GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID; + + if (strcmp ("ccid", name) == 0) + return GST_RTCP_SDES_CCID; + + if (strcmp ("mid", name) == 0) + return GST_RTCP_SDES_MID; + return GST_RTCP_SDES_PRIV; } diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.h b/gst-libs/gst/rtp/gstrtcpbuffer.h index 32291fa..3681c6d 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.h +++ b/gst-libs/gst/rtp/gstrtcpbuffer.h @@ -126,18 +126,74 @@ typedef enum * * Different types of SDES content. */ +/** + * GST_RTCP_SDES_H323_CADDR: + * + * H.323 callable address + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_APSI: + * + * Application Specific Identifier (RFC6776) + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_RGRP: + * + * Reporting Group Identifier (RFC8861) + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_RTP_STREAM_ID: + * + * RtpStreamId SDES item (RFC8852). + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID: + * + * RepairedRtpStreamId SDES item (RFC8852). + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_CCID: + * + * CLUE CaptId (RFC8849) + * + * Since: 1.20: + */ +/** + * GST_RTCP_SDES_MID: + * + * MID SDES item (RFC8843). + * + * Since: 1.20: + */ typedef enum { - GST_RTCP_SDES_INVALID = -1, - GST_RTCP_SDES_END = 0, - GST_RTCP_SDES_CNAME = 1, - GST_RTCP_SDES_NAME = 2, - GST_RTCP_SDES_EMAIL = 3, - GST_RTCP_SDES_PHONE = 4, - GST_RTCP_SDES_LOC = 5, - GST_RTCP_SDES_TOOL = 6, - GST_RTCP_SDES_NOTE = 7, - GST_RTCP_SDES_PRIV = 8 + GST_RTCP_SDES_INVALID = -1, + GST_RTCP_SDES_END = 0, + GST_RTCP_SDES_CNAME = 1, + GST_RTCP_SDES_NAME = 2, + GST_RTCP_SDES_EMAIL = 3, + GST_RTCP_SDES_PHONE = 4, + GST_RTCP_SDES_LOC = 5, + GST_RTCP_SDES_TOOL = 6, + GST_RTCP_SDES_NOTE = 7, + GST_RTCP_SDES_PRIV = 8, + GST_RTCP_SDES_H323_CADDR = 9, + GST_RTCP_SDES_APSI = 10, + GST_RTCP_SDES_RGRP = 11, + GST_RTCP_SDES_RTP_STREAM_ID = 12, + GST_RTCP_SDES_REPAIRED_RTP_STREAM_ID = 13, + GST_RTCP_SDES_CCID = 14, + GST_RTCP_SDES_MID = 15, } GstRTCPSDESType; /** diff --git a/tests/check/libs/rtp.c b/tests/check/libs/rtp.c index d5879ca..029260d 100644 --- a/tests/check/libs/rtp.c +++ b/tests/check/libs/rtp.c @@ -689,6 +689,25 @@ GST_START_TEST (test_rtp_seqnum_compare) GST_END_TEST; +GST_START_TEST (test_rtcp_sdes_type) +{ + GstRTCPSDESType i; + + for (i = 1; i < GST_RTCP_SDES_MID; i++) { + GstRTCPSDESType sdes_type; + const char *sdes_name; + + sdes_name = gst_rtcp_sdes_type_to_name (i); + GST_DEBUG ("%u (0x%x) -> \'%s\'", i, i, sdes_name); + fail_unless (sdes_name != NULL); + sdes_type = gst_rtcp_sdes_name_to_type (sdes_name); + + fail_unless_equals_int (sdes_type, i); + } +} + +GST_END_TEST; + GST_START_TEST (test_rtcp_buffer) { GstBuffer *buf; @@ -2229,6 +2248,7 @@ rtp_suite (void) //tcase_add_test (tc_chain, test_rtp_buffer_list_set_extension); tcase_add_test (tc_chain, test_rtp_seqnum_compare); + tcase_add_test (tc_chain, test_rtcp_sdes_type); tcase_add_test (tc_chain, test_rtcp_buffer); tcase_add_test (tc_chain, test_rtcp_reduced_buffer); tcase_add_test (tc_chain, test_rtcp_validate_with_padding); -- 2.7.4