From 6f57199958b321919b552ca4587f1c9e50052035 Mon Sep 17 00:00:00 2001 From: Havard Graff Date: Mon, 27 Jun 2016 14:28:06 +0200 Subject: [PATCH] rtprtxreceive: add ssrc-map property Mirroring the rtxsend, this allows the application to "pre-map" the retransmission-ssrcs to the "real" ssrc, if this information is known. Part-of: --- .../docs/gst_plugins_cache.json | 11 +++++++ .../gst/rtpmanager/gstrtprtxreceive.c | 29 +++++++++++++++++++ .../gst/rtpmanager/gstrtprtxreceive.h | 2 ++ 3 files changed, 42 insertions(+) diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json index 5d2b5b647c..7dd832070a 100644 --- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json +++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json @@ -18248,6 +18248,17 @@ "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" diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c index 7373eda98c..cfcedca910 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.c @@ -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) diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.h b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.h index 96f1fefa3b..fd628ba030 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.h +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtprtxreceive.h @@ -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;