rtp: add some additional rtcp sdes values
authorMatthew Waters <matthew@centricular.com>
Tue, 31 Aug 2021 05:31:23 +0000 (15:31 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 31 Aug 2021 06:09:47 +0000 (06:09 +0000)
Matches the current list at
https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-5
as of 2021-September.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1267>

gst-libs/gst/rtp/gstrtcpbuffer.c
gst-libs/gst/rtp/gstrtcpbuffer.h
tests/check/libs/rtp.c

index 876c4a9..5b58207 100644 (file)
@@ -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;
 }
 
index 32291fa..3681c6d 100644 (file)
@@ -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;
 
 /**
index d5879ca..029260d 100644 (file)
@@ -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);