Commit c6cce4a6 authored by Aleix Conchillo Flaque's avatar Aleix Conchillo Flaque Committed by Wim Taymans

rtsp-media: also initialize transports in on_ssrc_active (bug #683304)

* gst/rtsp-server/rtsp-media.c: GstRTSPMediaStream transports might not
  be available in "on_new_ssrc". The transports are added in
  gst_rtsp_media_set_state when going to PLAYING state. However,
  "on_new_ssrc" might be called before this happens.

  https://bugzilla.gnome.org/show_bug.cgi?id=683304
parent bef57648
......@@ -361,7 +361,7 @@ collect_media_stats (GstRTSPMedia * media)
* gst_rtsp_media_new:
*
* Create a new #GstRTSPMedia instance. The #GstRTSPMedia object contains the
* element to produde RTP data for one or more related (audio/video/..)
* element to produce RTP data for one or more related (audio/video/..)
* streams.
*
* Returns: a new #GstRTSPMedia object.
......@@ -1078,7 +1078,8 @@ find_transport (GstRTSPMediaStream * stream, const gchar * rtcp_from)
port = atoi (tmp + 1);
dest = g_strndup (rtcp_from, tmp - rtcp_from);
GST_INFO ("finding %s:%d", dest, port);
GST_INFO ("finding %s:%d in %d transports", dest, port,
g_list_length (stream->transports));
for (walk = stream->transports; walk; walk = g_list_next (walk)) {
GstRTSPMediaTrans *trans = walk->data;
......@@ -1098,14 +1099,12 @@ find_transport (GstRTSPMediaStream * stream, const gchar * rtcp_from)
return result;
}
static void
on_new_ssrc (GObject * session, GObject * source, GstRTSPMediaStream * stream)
static GstRTSPMediaTrans *
check_transport (GObject * source, GstRTSPMediaStream * stream)
{
GstStructure *stats;
GstRTSPMediaTrans *trans;
GST_INFO ("%p: new source %p", stream, source);
/* see if we have a stream to match with the origin of the RTCP packet */
trans = g_object_get_qdata (source, ssrc_stream_map_key);
if (trans == NULL) {
......@@ -1127,9 +1126,22 @@ on_new_ssrc (GObject * session, GObject * source, GstRTSPMediaStream * stream)
}
gst_structure_free (stats);
}
} else {
GST_INFO ("%p: source %p for transport %p", stream, source, trans);
}
return trans;
}
static void
on_new_ssrc (GObject * session, GObject * source, GstRTSPMediaStream * stream)
{
GstRTSPMediaTrans *trans;
GST_INFO ("%p: new source %p", stream, source);
trans = check_transport (source, stream);
if (trans)
GST_INFO ("%p: source %p for transport %p", stream, source, trans);
}
static void
......@@ -1144,9 +1156,10 @@ on_ssrc_active (GObject * session, GObject * source,
{
GstRTSPMediaTrans *trans;
trans = g_object_get_qdata (source, ssrc_stream_map_key);
trans = check_transport (source, stream);
GST_INFO ("%p: source %p in transport %p is active", stream, source, trans);
if (trans)
GST_INFO ("%p: source %p in transport %p is active", stream, source, trans);
if (trans && trans->keep_alive)
trans->keep_alive (trans->ka_user_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment