diff options
author | Hyunjun Ko <zzoon.ko@samsung.com> | 2015-10-02 16:11:05 +0900 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-10-02 16:40:31 +0300 |
commit | a51337974cdb1aa56db5e4ef87a1bb52a7423979 (patch) | |
tree | e2e10f5baedb6ad684455e3dd863aabd78715266 | |
parent | 3cc2c2c22677c7f8d17c62f4db43db6ff0bbe118 (diff) |
stream: listen to sender ssrc signals
https://bugzilla.gnome.org/show_bug.cgi?id=746747
-rw-r--r-- | examples/test-mp4.c | 22 | ||||
-rw-r--r-- | gst/rtsp-server/rtsp-stream.c | 38 |
2 files changed, 60 insertions, 0 deletions
diff --git a/examples/test-mp4.c b/examples/test-mp4.c index 34b8906..2ebe98c 100644 --- a/examples/test-mp4.c +++ b/examples/test-mp4.c @@ -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); } } diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 4417c43..4e5f644 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1683,6 +1683,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) { if (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 |