summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunjun Ko <zzoon.ko@samsung.com>2015-04-15 09:45:23 +0900
committerSebastian Dröge <sebastian@centricular.com>2015-04-15 15:14:04 +0200
commitde590b4b2a8aa1c9de9bf263cd63e23aca4ca0ea (patch)
treee21d9bb557b50226b81f4213f087dae4f888720f
parentbff66c00041b9b009f7e10f294f3ae683737bfb7 (diff)
rtsp-stream: fix to get valid each stream data for request-aux-sender signal
Because of duplicated g_signal_connect for request-aux-sender signal, wrong stream pointer is passed to the signal handler. Instead of passing each stream, pass stream array and get the relevant stream. https://bugzilla.gnome.org/show_bug.cgi?id=747839
-rw-r--r--gst/rtsp-server/rtsp-media.c25
-rw-r--r--gst/rtsp-server/rtsp-stream.c11
-rw-r--r--gst/rtsp-server/rtsp-stream.h2
3 files changed, 30 insertions, 8 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index 8b25e07..344ac27 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -2440,6 +2440,25 @@ preroll_failed:
}
}
+static GstElement *
+request_aux_sender (GstElement * rtpbin, guint sessid, GstRTSPMedia * media)
+{
+ GstRTSPMediaPrivate *priv = media->priv;
+ GstRTSPStream *stream = NULL;
+ guint i;
+
+ g_mutex_lock (&priv->lock);
+ for (i = 0; i < priv->streams->len; i++) {
+ stream = g_ptr_array_index (priv->streams, i);
+
+ if (sessid == gst_rtsp_stream_get_index (stream))
+ break;
+ }
+ g_mutex_unlock (&priv->lock);
+
+ return gst_rtsp_stream_request_aux_sender (stream, sessid);
+}
+
static gboolean
start_prepare (GstRTSPMedia * media)
{
@@ -2454,6 +2473,12 @@ start_prepare (GstRTSPMedia * media)
stream = g_ptr_array_index (priv->streams, i);
+ if (priv->rtx_time > 0) {
+ /* enable retransmission by setting rtprtxsend as the "aux" element of rtpbin */
+ g_signal_connect (priv->rtpbin, "request-aux-sender",
+ (GCallback) request_aux_sender, media);
+ }
+
if (!gst_rtsp_stream_join_bin (stream, GST_BIN (priv->pipeline),
priv->rtpbin, GST_STATE_NULL)) {
goto join_bin_failed;
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c
index dfbd4a3..8a4abed 100644
--- a/gst/rtsp-server/rtsp-stream.c
+++ b/gst/rtsp-server/rtsp-stream.c
@@ -1817,8 +1817,8 @@ request_rtp_rtcp_decoder (GstElement * rtpbin, guint session,
return gst_object_ref (priv->srtpdec);
}
-static GstElement *
-request_aux_sender (GstElement * rtpbin, guint sessid, GstRTSPStream * stream)
+GstElement *
+gst_rtsp_stream_request_aux_sender (GstRTSPStream * stream, guint sessid)
{
GstElement *bin;
GstPad *pad;
@@ -1827,6 +1827,8 @@ request_aux_sender (GstElement * rtpbin, guint sessid, GstRTSPStream * stream)
guint pt, rtx_pt;
gchar *pt_s;
+ g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
+
pt = gst_rtsp_stream_get_pt (stream);
pt_s = g_strdup_printf ("%u", pt);
rtx_pt = stream->priv->rtx_pt;
@@ -2012,11 +2014,6 @@ gst_rtsp_stream_join_bin (GstRTSPStream * stream, GstBin * bin,
(GCallback) request_rtp_rtcp_decoder, stream);
}
- if (priv->rtx_time > 0 && priv->srcpad) {
- /* enable retransmission by setting rtprtxsend as the "aux" element of rtpbin */
- g_signal_connect (rtpbin, "request-aux-sender",
- (GCallback) request_aux_sender, stream);
- }
if (priv->sinkpad) {
g_signal_connect (rtpbin, "request-pt-map",
(GCallback) request_pt_map, stream);
diff --git a/gst/rtsp-server/rtsp-stream.h b/gst/rtsp-server/rtsp-stream.h
index d5f890c..49771c3 100644
--- a/gst/rtsp-server/rtsp-stream.h
+++ b/gst/rtsp-server/rtsp-stream.h
@@ -163,7 +163,7 @@ void gst_rtsp_stream_set_retransmission_pt (GstRTSPStream * s
guint rtx_pt);
void gst_rtsp_stream_set_pt_map (GstRTSPStream * stream, guint pt, GstCaps * caps);
-
+GstElement * gst_rtsp_stream_request_aux_sender (GstRTSPStream * stream, guint sessid);
/**
* GstRTSPStreamTransportFilterFunc:
* @stream: a #GstRTSPStream object