stream: listen to sender ssrc signals

https://bugzilla.gnome.org/show_bug.cgi?id=746747
This commit is contained in:
Hyunjun Ko 2015-10-02 16:11:05 +09:00 committed by Sebastian Dröge
parent 3cc2c2c226
commit a51337974c
2 changed files with 60 additions and 0 deletions

View file

@ -51,6 +51,26 @@ on_ssrc_active (GObject * session, GObject * source, GstRTSPMedia * media)
}
}
static void
on_sender_ssrc_active (GObject * session, GObject * source,
GstRTSPMedia * media)
{
GstStructure *stats;
GST_INFO ("source %p in session %p is active", source, session);
g_object_get (source, "stats", &stats, NULL);
if (stats) {
gchar *sstr;
sstr = gst_structure_to_string (stats);
g_print ("Sender stats:\nstructure: %s\n", sstr);
g_free (sstr);
gst_structure_free (stats);
}
}
/* signal callback when the media is prepared for streaming. We can get the
* session manager for each of the streams and connect to some signals. */
static void
@ -75,6 +95,8 @@ media_prepared_cb (GstRTSPMedia * media)
g_signal_connect (session, "on-ssrc-active",
(GCallback) on_ssrc_active, media);
g_signal_connect (session, "on-sender-ssrc-active",
(GCallback) on_sender_ssrc_active, media);
}
}

View file

@ -1682,6 +1682,38 @@ on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
}
}
static void
on_new_sender_ssrc (GObject * session, GObject * source, GstRTSPStream * stream)
{
GST_INFO ("%p: new sender source %p", stream, source);
#ifndef DUMP_STATS
{
GstStructure *stats;
g_object_get (source, "stats", &stats, NULL);
if (stats) {
dump_structure (stats);
gst_structure_free (stats);
}
}
#endif
}
static void
on_sender_ssrc_active (GObject * session, GObject * source,
GstRTSPStream * stream)
{
#ifndef DUMP_STATS
{
GstStructure *stats;
g_object_get (source, "stats", &stats, NULL);
if (stats) {
dump_structure (stats);
gst_structure_free (stats);
}
}
#endif
}
static void
clear_tr_cache (GstRTSPStreamPrivate * priv, gboolean is_rtp)
{
@ -2135,6 +2167,12 @@ gst_rtsp_stream_join_bin (GstRTSPStream * stream, GstBin * bin,
g_signal_connect (priv->session, "on-timeout", (GCallback) on_timeout,
stream);
/* signal for sender ssrc */
g_signal_connect (priv->session, "on-new-sender-ssrc",
(GCallback) on_new_sender_ssrc, stream);
g_signal_connect (priv->session, "on-sender-ssrc-active",
(GCallback) on_sender_ssrc_active, stream);
for (i = 0; i < 2; i++) {
GstPad *teepad, *queuepad;
/* For the sender we create this bit of pipeline for both