Commit 20d8fc4e authored by Sebastian Rasmussen's avatar Sebastian Rasmussen Committed by Sebastian Dröge

rtsp-media: Do not prepare media after media times out

Deferred calls to start_prepare() can be deferred past the point until
which wait_preroll() and by proxy gst_rtsp_media_get_status() is
prepared to wait. Previously there was no lock and no check for this
situation. This meant that a media could be prepared and unprepared
simultaneously by two different threads. Now a lock is in place and a
suitable check is done.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=759773
parent 83ddde99
......@@ -2487,6 +2487,10 @@ start_prepare (GstRTSPMedia * media)
guint i;
GList *walk;
g_rec_mutex_lock (&priv->state_lock);
if (priv->status != GST_RTSP_MEDIA_STATUS_PREPARING)
goto no_longer_preparing;
/* link streams we already have, other streams might appear when we have
* dynamic elements */
for (i = 0; i < priv->streams->len; i++) {
......@@ -2535,18 +2539,28 @@ start_prepare (GstRTSPMedia * media)
if (!start_preroll (media))
goto preroll_failed;
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
no_longer_preparing:
{
GST_INFO ("media is no longer preparing");
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
}
join_bin_failed:
{
GST_WARNING ("failed to join bin element");
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_ERROR);
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
}
preroll_failed:
{
GST_WARNING ("failed to preroll pipeline");
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_ERROR);
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
}
}
......
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