rtsp-media: remove transports if media is in error status

* gst/rtsp-server/rtsp-media.c (gst_rtsp_media_set_state): if we are
  trying to change to GST_STATE_NULL and media is in error status, we
  remove all transports.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=712776
This commit is contained in:
Aleix Conchillo Flaque 2013-11-20 15:51:54 -08:00 committed by Wim Taymans
parent 7b5763179a
commit b6d4a29d75

View file

@ -2187,6 +2187,8 @@ gst_rtsp_media_set_state (GstRTSPMedia * media, GstState state,
priv = media->priv;
g_rec_mutex_lock (&priv->state_lock);
if (priv->status == GST_RTSP_MEDIA_STATUS_ERROR)
goto error_status;
if (priv->status != GST_RTSP_MEDIA_STATUS_PREPARED)
goto not_prepared;
@ -2268,6 +2270,26 @@ not_prepared:
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
}
error_status:
{
GST_WARNING ("media %p in error status while changing to state %d",
media, state);
if (state == GST_STATE_NULL) {
for (i = 0; i < transports->len; i++) {
GstRTSPStreamTransport *trans;
/* we need a non-NULL entry in the array */
trans = g_ptr_array_index (transports, i);
if (trans == NULL)
continue;
gst_rtsp_stream_transport_set_active (trans, FALSE);
}
priv->n_active = 0;
}
g_rec_mutex_unlock (&priv->state_lock);
return FALSE;
}
}
/* called with state-lock */