rtprtxreceive: add ssrc-map property
authorHavard Graff <havard.graff@gmail.com>
Mon, 27 Jun 2016 12:28:06 +0000 (14:28 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 14 Mar 2022 09:14:10 +0000 (09:14 +0000)
Mirroring the rtxsend, this allows the application to "pre-map" the
retransmission-ssrcs to the "real" ssrc, if this information is known.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1878>

subprojects/gst-plugins-good/docs/gst_plugins_cache.json
subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c
subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.h

index 5d2b5b6..7dd8320 100644 (file)
                         "readable": true,
                         "type": "GstStructure",
                         "writable": true
+                    },
+                    "ssrc-map": {
+                        "blurb": "Map of SSRCs to their retransmission SSRCs for SSRC-multiplexed mode",
+                        "conditionally-available": false,
+                        "construct": false,
+                        "construct-only": false,
+                        "controllable": false,
+                        "mutable": "null",
+                        "readable": false,
+                        "type": "GstStructure",
+                        "writable": true
                     }
                 },
                 "rank": "none"
index 7373eda..cfcedca 100644 (file)
@@ -159,6 +159,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_rtp_rtx_receive_debug);
 enum
 {
   PROP_0,
+  PROP_SSRC_MAP,
   PROP_PAYLOAD_TYPE_MAP,
   PROP_NUM_RTX_REQUESTS,
   PROP_NUM_RTX_PACKETS,
@@ -210,6 +211,22 @@ gst_rtp_rtx_receive_class_init (GstRtpRtxReceiveClass * klass)
   gobject_class->set_property = gst_rtp_rtx_receive_set_property;
   gobject_class->finalize = gst_rtp_rtx_receive_finalize;
 
+  /**
+   * GstRtpRtxReceive:ssrc-map:
+   *
+   * Map of SSRCs to their retransmission SSRCs for SSRC-multiplexed mode.
+   *
+   * If an application know this information already (WebRTC signals this
+   * in their SDP), it can allow the rtxreceive element to know a packet
+   * is a "valid" RTX packet even if it has not been requested.
+   *
+   * Since: 1.22
+   */
+  g_object_class_install_property (gobject_class, PROP_SSRC_MAP,
+      g_param_spec_boxed ("ssrc-map", "SSRC Map",
+          "Map of SSRCs to their retransmission SSRCs for SSRC-multiplexed mode",
+          GST_TYPE_STRUCTURE, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_property (gobject_class, PROP_PAYLOAD_TYPE_MAP,
       g_param_spec_boxed ("payload-type-map", "Payload Type Map",
           "Map of original payload types to their retransmission payload types",
@@ -261,6 +278,8 @@ gst_rtp_rtx_receive_finalize (GObject * object)
   GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (object);
 
   g_hash_table_unref (rtx->ssrc2_ssrc1_map);
+  if (rtx->external_ssrc_map)
+    gst_structure_free (rtx->external_ssrc_map);
   g_hash_table_unref (rtx->seqnum_ssrc1_map);
   g_hash_table_unref (rtx->rtx_pt_map);
   if (rtx->rtx_pt_map_structure)
@@ -761,6 +780,16 @@ gst_rtp_rtx_receive_set_property (GObject * object,
   GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (object);
 
   switch (prop_id) {
+    case PROP_SSRC_MAP:
+      GST_OBJECT_LOCK (rtx);
+      if (rtx->external_ssrc_map)
+        gst_structure_free (rtx->external_ssrc_map);
+      rtx->external_ssrc_map = g_value_dup_boxed (value);
+      g_hash_table_remove_all (rtx->ssrc2_ssrc1_map);
+      gst_structure_foreach (rtx->external_ssrc_map,
+          structure_to_hash_table_inv, rtx->ssrc2_ssrc1_map);
+      GST_OBJECT_UNLOCK (rtx);
+      break;
     case PROP_PAYLOAD_TYPE_MAP:
       GST_OBJECT_LOCK (rtx);
       if (rtx->rtx_pt_map_structure)
index 96f1fef..fd628ba 100644 (file)
@@ -52,6 +52,8 @@ struct _GstRtpRtxReceive
    * as we make sure all ssrc are unique */
   GHashTable *ssrc2_ssrc1_map;
 
+  GstStructure *external_ssrc_map;
+
   /* contains seqnum of request packets of whom their ssrc have
    * not been associated to a rtx stream yet */
   GHashTable *seqnum_ssrc1_map;