diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2020-09-24 20:13:00 +0300 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2020-10-16 19:45:56 +0300 |
commit | b113516241de2b8ddd71b85b22458d98acde4451 (patch) | |
tree | 9492f56b149155ba53acb2203f247c3bb9e2aaae /gst/rtpmanager | |
parent | 3348c5ceae6ff8df1f64f50f21e65711186678ff (diff) |
rtpbin: Add clear-ssrc action
This action signal will delegate to clear-ssrc onto the rtpssrcdemux element
associated with the session. This allow rtpbin users to clear pads and
elements for a specific ssrc that is known to no longer be in use. This
happens when a pad is reused in rtpsrc or ristsrc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/736>
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r-- | gst/rtpmanager/gstrtpbin.c | 39 | ||||
-rw-r--r-- | gst/rtpmanager/gstrtpbin.h | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c index 6b558c0a4..622e455c1 100644 --- a/gst/rtpmanager/gstrtpbin.c +++ b/gst/rtpmanager/gstrtpbin.c @@ -292,6 +292,7 @@ enum SIGNAL_GET_INTERNAL_SESSION, SIGNAL_GET_STORAGE, SIGNAL_GET_INTERNAL_STORAGE, + SIGNAL_CLEAR_SSRC, SIGNAL_ON_NEW_SSRC, SIGNAL_ON_SSRC_COLLISION, @@ -1138,6 +1139,25 @@ gst_rtp_bin_get_internal_storage (GstRtpBin * bin, guint session_id) return internal_storage; } +static void +gst_rtp_bin_clear_ssrc (GstRtpBin * bin, guint session_id, guint32 ssrc) +{ + GstRtpBinSession *session; + GstElement *demux = NULL; + + GST_RTP_BIN_LOCK (bin); + GST_DEBUG_OBJECT (bin, "clearing ssrc %u for session %u", ssrc, session_id); + session = find_session_by_id (bin, (gint) session_id); + if (session) + demux = gst_object_ref (session->demux); + GST_RTP_BIN_UNLOCK (bin); + + if (demux) { + g_signal_emit_by_name (demux, "clear-ssrc", ssrc, NULL); + gst_object_unref (demux); + } +} + static GstElement * gst_rtp_bin_request_encoder (GstRtpBin * bin, guint session_id) { @@ -2152,6 +2172,24 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass) get_storage), NULL, NULL, NULL, GST_TYPE_ELEMENT, 1, G_TYPE_UINT); /** + * GstRtpBin::clear-ssrc: + * @rtpbin: the object which received the signal + * @id: the session id + * @ssrc: the ssrc + * + * Remove all pads from rtpssrcdemux element associated with the specified + * ssrc. This delegate the action signal to the rtpssrcdemux element + * associated with the specified session. + * + * Since: 1.20 + */ + gst_rtp_bin_signals[SIGNAL_CLEAR_SSRC] = + g_signal_new ("clear-ssrc", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass, + clear_ssrc), NULL, NULL, NULL, G_TYPE_NONE, 2, + G_TYPE_UINT, G_TYPE_UINT); + + /** * GstRtpBin::on-new-ssrc: * @rtpbin: the object which received the signal * @session: the session @@ -2768,6 +2806,7 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass) klass->get_storage = GST_DEBUG_FUNCPTR (gst_rtp_bin_get_storage); klass->get_internal_storage = GST_DEBUG_FUNCPTR (gst_rtp_bin_get_internal_storage); + klass->clear_ssrc = GST_DEBUG_FUNCPTR (gst_rtp_bin_clear_ssrc); klass->request_rtp_encoder = GST_DEBUG_FUNCPTR (gst_rtp_bin_request_encoder); klass->request_rtp_decoder = GST_DEBUG_FUNCPTR (gst_rtp_bin_request_decoder); klass->request_rtcp_encoder = GST_DEBUG_FUNCPTR (gst_rtp_bin_request_encoder); diff --git a/gst/rtpmanager/gstrtpbin.h b/gst/rtpmanager/gstrtpbin.h index 1185c40e8..257c236fa 100644 --- a/gst/rtpmanager/gstrtpbin.h +++ b/gst/rtpmanager/gstrtpbin.h @@ -117,6 +117,7 @@ struct _GstRtpBinClass { RTPSession* (*get_internal_session) (GstRtpBin *rtpbin, guint session); GstElement* (*get_storage) (GstRtpBin *rtpbin, guint session); GObject* (*get_internal_storage) (GstRtpBin *rtpbin, guint session); + void (*clear_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc); /* session manager signals */ void (*on_new_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc); |