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>
This commit is contained in:
Nicolas Dufresne 2020-09-24 13:13:00 -04:00 committed by GStreamer Merge Bot
parent 3348c5ceae
commit b113516241
3 changed files with 55 additions and 0 deletions

View file

@ -16448,6 +16448,21 @@
"return-type": "void",
"when": "last"
},
"clear-ssrc": {
"action": true,
"args": [
{
"name": "arg0",
"type": "guint"
},
{
"name": "arg1",
"type": "guint"
}
],
"return-type": "void",
"when": "last"
},
"get-internal-session": {
"action": true,
"args": [

View file

@ -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)
{
@ -2151,6 +2171,24 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRtpBinClass,
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
@ -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);

View file

@ -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);