gst/rtpmanager/: Add notification of active SSRCs to various RTP elements. Fixes #478566.

Original commit message from CVS:
* gst/rtpmanager/gstrtpbin.c: (on_ssrc_active), (create_session),
(gst_rtp_bin_class_init):
* gst/rtpmanager/gstrtpbin.h:
* gst/rtpmanager/gstrtpsession.c: (on_ssrc_active),
(gst_rtp_session_class_init), (gst_rtp_session_init),
(gst_rtp_session_event_send_rtp_sink):
* gst/rtpmanager/gstrtpsession.h:
* gst/rtpmanager/rtpsession.c: (rtp_session_class_init),
(on_ssrc_active), (rtp_session_process_rb):
* gst/rtpmanager/rtpsession.h:
Add notification of active SSRCs to various RTP elements. Fixes #478566.
This commit is contained in:
Wim Taymans 2007-09-20 14:34:57 +00:00 committed by Tim-Philipp Müller
parent 56d5832287
commit 949f1685ce
6 changed files with 74 additions and 0 deletions

View file

@ -221,6 +221,7 @@ enum
SIGNAL_ON_NEW_SSRC, SIGNAL_ON_NEW_SSRC,
SIGNAL_ON_SSRC_COLLISION, SIGNAL_ON_SSRC_COLLISION,
SIGNAL_ON_SSRC_VALIDATED, SIGNAL_ON_SSRC_VALIDATED,
SIGNAL_ON_SSRC_ACTIVE,
SIGNAL_ON_BYE_SSRC, SIGNAL_ON_BYE_SSRC,
SIGNAL_ON_BYE_TIMEOUT, SIGNAL_ON_BYE_TIMEOUT,
SIGNAL_ON_TIMEOUT, SIGNAL_ON_TIMEOUT,
@ -384,6 +385,13 @@ on_ssrc_validated (GstElement * session, guint32 ssrc, GstRtpBinSession * sess)
sess->id, ssrc); sess->id, ssrc);
} }
static void
on_ssrc_active (GstElement * session, guint32 ssrc, GstRtpBinSession * sess)
{
g_signal_emit (sess->bin, gst_rtp_bin_signals[SIGNAL_ON_SSRC_ACTIVE], 0,
sess->id, ssrc);
}
static void static void
on_bye_ssrc (GstElement * session, guint32 ssrc, GstRtpBinSession * sess) on_bye_ssrc (GstElement * session, guint32 ssrc, GstRtpBinSession * sess)
{ {
@ -440,6 +448,8 @@ create_session (GstRtpBin * rtpbin, gint id)
(GCallback) on_ssrc_collision, sess); (GCallback) on_ssrc_collision, sess);
g_signal_connect (sess->session, "on-ssrc-validated", g_signal_connect (sess->session, "on-ssrc-validated",
(GCallback) on_ssrc_validated, sess); (GCallback) on_ssrc_validated, sess);
g_signal_connect (sess->session, "on-ssrc-active",
(GCallback) on_ssrc_active, sess);
g_signal_connect (sess->session, "on-bye-ssrc", g_signal_connect (sess->session, "on-bye-ssrc",
(GCallback) on_bye_ssrc, sess); (GCallback) on_bye_ssrc, sess);
g_signal_connect (sess->session, "on-bye-timeout", g_signal_connect (sess->session, "on-bye-timeout",
@ -1082,6 +1092,19 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass, on_ssrc_validated), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass, on_ssrc_validated),
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2, NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_UINT); G_TYPE_UINT, G_TYPE_UINT);
/**
* GstRtpBin::on-ssrc_active:
* @rtpbin: the object which received the signal
* @session: the session
* @ssrc: the SSRC
*
* Notify of a SSRC that is active, i.e., sending RTCP.
*/
gst_rtp_bin_signals[SIGNAL_ON_SSRC_ACTIVE] =
g_signal_new ("on-ssrc-active", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass, on_ssrc_active),
NULL, NULL, gst_rtp_bin_marshal_VOID__UINT_UINT, G_TYPE_NONE, 2,
G_TYPE_UINT, G_TYPE_UINT);
/** /**
* GstRtpBin::on-bye-ssrc: * GstRtpBin::on-bye-ssrc:

View file

@ -65,6 +65,7 @@ struct _GstRtpBinClass {
void (*on_new_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_new_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_ssrc_collision) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_ssrc_collision) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_ssrc_validated) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_ssrc_validated) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_ssrc_active) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_bye_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_bye_ssrc) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_bye_timeout) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_bye_timeout) (GstRtpBin *rtpbin, guint session, guint32 ssrc);
void (*on_timeout) (GstRtpBin *rtpbin, guint session, guint32 ssrc); void (*on_timeout) (GstRtpBin *rtpbin, guint session, guint32 ssrc);

View file

@ -208,6 +208,7 @@ enum
SIGNAL_ON_NEW_SSRC, SIGNAL_ON_NEW_SSRC,
SIGNAL_ON_SSRC_COLLISION, SIGNAL_ON_SSRC_COLLISION,
SIGNAL_ON_SSRC_VALIDATED, SIGNAL_ON_SSRC_VALIDATED,
SIGNAL_ON_SSRC_ACTIVE,
SIGNAL_ON_BYE_SSRC, SIGNAL_ON_BYE_SSRC,
SIGNAL_ON_BYE_TIMEOUT, SIGNAL_ON_BYE_TIMEOUT,
SIGNAL_ON_TIMEOUT, SIGNAL_ON_TIMEOUT,
@ -306,6 +307,13 @@ on_ssrc_validated (RTPSession * session, RTPSource * src, GstRtpSession * sess)
src->ssrc); src->ssrc);
} }
static void
on_ssrc_active (RTPSession * session, RTPSource * src, GstRtpSession * sess)
{
g_signal_emit (sess, gst_rtp_session_signals[SIGNAL_ON_SSRC_ACTIVE], 0,
src->ssrc);
}
static void static void
on_bye_ssrc (RTPSession * session, RTPSource * src, GstRtpSession * sess) on_bye_ssrc (RTPSession * session, RTPSource * src, GstRtpSession * sess)
{ {
@ -429,6 +437,18 @@ gst_rtp_session_class_init (GstRtpSessionClass * klass)
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpSessionClass, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpSessionClass,
on_ssrc_validated), NULL, NULL, g_cclosure_marshal_VOID__UINT, on_ssrc_validated), NULL, NULL, g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT); G_TYPE_NONE, 1, G_TYPE_UINT);
/**
* GstRtpSession::on-ssrc_active:
* @sess: the object which received the signal
* @ssrc: the SSRC
*
* Notify of a SSRC that is active, i.e., sending RTCP.
*/
gst_rtp_session_signals[SIGNAL_ON_SSRC_ACTIVE] =
g_signal_new ("on-ssrc-active", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpSessionClass,
on_ssrc_active), NULL, NULL, g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
/** /**
* GstRtpSession::on-bye-ssrc: * GstRtpSession::on-bye-ssrc:
@ -497,6 +517,8 @@ gst_rtp_session_init (GstRtpSession * rtpsession, GstRtpSessionClass * klass)
(GCallback) on_ssrc_collision, rtpsession); (GCallback) on_ssrc_collision, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-ssrc-validated", g_signal_connect (rtpsession->priv->session, "on-ssrc-validated",
(GCallback) on_ssrc_validated, rtpsession); (GCallback) on_ssrc_validated, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-ssrc-active",
(GCallback) on_ssrc_active, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-bye-ssrc", g_signal_connect (rtpsession->priv->session, "on-bye-ssrc",
(GCallback) on_bye_ssrc, rtpsession); (GCallback) on_bye_ssrc, rtpsession);
g_signal_connect (rtpsession->priv->session, "on-bye-timeout", g_signal_connect (rtpsession->priv->session, "on-bye-timeout",
@ -1229,6 +1251,9 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstEvent * event)
ret = gst_pad_push_event (rtpsession->send_rtp_src, event); ret = gst_pad_push_event (rtpsession->send_rtp_src, event);
break; break;
} }
case GST_EVENT_EOS:
ret = gst_pad_push_event (rtpsession->send_rtp_src, event);
break;
default: default:
ret = gst_pad_push_event (rtpsession->send_rtp_src, event); ret = gst_pad_push_event (rtpsession->send_rtp_src, event);
break; break;

View file

@ -66,6 +66,7 @@ struct _GstRtpSessionClass {
void (*on_new_ssrc) (GstRtpSession *sess, guint32 ssrc); void (*on_new_ssrc) (GstRtpSession *sess, guint32 ssrc);
void (*on_ssrc_collision) (GstRtpSession *sess, guint32 ssrc); void (*on_ssrc_collision) (GstRtpSession *sess, guint32 ssrc);
void (*on_ssrc_validated) (GstRtpSession *sess, guint32 ssrc); void (*on_ssrc_validated) (GstRtpSession *sess, guint32 ssrc);
void (*on_ssrc_active) (GstRtpSession *sess, guint32 ssrc);
void (*on_bye_ssrc) (GstRtpSession *sess, guint32 ssrc); void (*on_bye_ssrc) (GstRtpSession *sess, guint32 ssrc);
void (*on_bye_timeout) (GstRtpSession *sess, guint32 ssrc); void (*on_bye_timeout) (GstRtpSession *sess, guint32 ssrc);
void (*on_timeout) (GstRtpSession *sess, guint32 ssrc); void (*on_timeout) (GstRtpSession *sess, guint32 ssrc);

View file

@ -36,6 +36,7 @@ enum
SIGNAL_ON_NEW_SSRC, SIGNAL_ON_NEW_SSRC,
SIGNAL_ON_SSRC_COLLISION, SIGNAL_ON_SSRC_COLLISION,
SIGNAL_ON_SSRC_VALIDATED, SIGNAL_ON_SSRC_VALIDATED,
SIGNAL_ON_SSRC_ACTIVE,
SIGNAL_ON_BYE_SSRC, SIGNAL_ON_BYE_SSRC,
SIGNAL_ON_BYE_TIMEOUT, SIGNAL_ON_BYE_TIMEOUT,
SIGNAL_ON_TIMEOUT, SIGNAL_ON_TIMEOUT,
@ -119,6 +120,18 @@ rtp_session_class_init (RTPSessionClass * klass)
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_ssrc_validated), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_ssrc_validated),
NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
G_TYPE_OBJECT); G_TYPE_OBJECT);
/**
* RTPSession::on-ssrc_active:
* @session: the object which received the signal
* @src: the active RTPSource
*
* Notify of a SSRC that is active, i.e., sending RTCP.
*/
rtp_session_signals[SIGNAL_ON_SSRC_ACTIVE] =
g_signal_new ("on-ssrc-active", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (RTPSessionClass, on_ssrc_active),
NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
G_TYPE_OBJECT);
/** /**
* RTPSession::on-bye-ssrc: * RTPSession::on-bye-ssrc:
* @session: the object which received the signal * @session: the object which received the signal
@ -281,6 +294,14 @@ on_ssrc_validated (RTPSession * sess, RTPSource * source)
RTP_SESSION_LOCK (sess); RTP_SESSION_LOCK (sess);
} }
static void
on_ssrc_active (RTPSession * sess, RTPSource * source)
{
RTP_SESSION_UNLOCK (sess);
g_signal_emit (sess, rtp_session_signals[SIGNAL_ON_SSRC_ACTIVE], 0, source);
RTP_SESSION_LOCK (sess);
}
static void static void
on_bye_ssrc (RTPSession * sess, RTPSource * source) on_bye_ssrc (RTPSession * sess, RTPSource * source)
{ {
@ -1080,6 +1101,8 @@ rtp_session_process_rb (RTPSession * sess, RTPSource * source,
* the other sender to see if we are better or worse. */ * the other sender to see if we are better or worse. */
rtp_source_process_rb (source, arrival->time, fractionlost, packetslost, rtp_source_process_rb (source, arrival->time, fractionlost, packetslost,
exthighestseq, jitter, lsr, dlsr); exthighestseq, jitter, lsr, dlsr);
on_ssrc_active (sess, source);
} }
} }
} }

View file

@ -209,6 +209,7 @@ struct _RTPSessionClass {
void (*on_new_ssrc) (RTPSession *sess, RTPSource *source); void (*on_new_ssrc) (RTPSession *sess, RTPSource *source);
void (*on_ssrc_collision) (RTPSession *sess, RTPSource *source); void (*on_ssrc_collision) (RTPSession *sess, RTPSource *source);
void (*on_ssrc_validated) (RTPSession *sess, RTPSource *source); void (*on_ssrc_validated) (RTPSession *sess, RTPSource *source);
void (*on_ssrc_active) (RTPSession *sess, RTPSource *source);
void (*on_bye_ssrc) (RTPSession *sess, RTPSource *source); void (*on_bye_ssrc) (RTPSession *sess, RTPSource *source);
void (*on_bye_timeout) (RTPSession *sess, RTPSource *source); void (*on_bye_timeout) (RTPSession *sess, RTPSource *source);
void (*on_timeout) (RTPSession *sess, RTPSource *source); void (*on_timeout) (RTPSession *sess, RTPSource *source);