mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
rtsp-media: Fix race codition in finish_unprepare
The previous fix for race condition around finish_unprepare where the function could be called twice assumed that the status wouldn't change during execution of the function. This assumption is incorrect as the state may change, for example if an error message arrives from the pipeline bus. Instead a flag keeping track on whether the finish_unprepare function is currently executing is introduced and checked. Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/59
This commit is contained in:
parent
d5ccb5a7d0
commit
ae32203cb0
1 changed files with 7 additions and 3 deletions
|
@ -115,6 +115,7 @@ struct _GstRTSPMediaPrivate
|
||||||
gint prepare_count;
|
gint prepare_count;
|
||||||
gint n_active;
|
gint n_active;
|
||||||
gboolean complete;
|
gboolean complete;
|
||||||
|
gboolean finishing_unprepare;
|
||||||
|
|
||||||
/* the pipeline for the media */
|
/* the pipeline for the media */
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
|
@ -3618,6 +3619,10 @@ finish_unprepare (GstRTSPMedia * media)
|
||||||
gint i;
|
gint i;
|
||||||
GList *walk;
|
GList *walk;
|
||||||
|
|
||||||
|
if (priv->finishing_unprepare)
|
||||||
|
return;
|
||||||
|
priv->finishing_unprepare = TRUE;
|
||||||
|
|
||||||
GST_DEBUG ("shutting down");
|
GST_DEBUG ("shutting down");
|
||||||
|
|
||||||
/* release the lock on shutdown, otherwise pad_added_cb might try to
|
/* release the lock on shutdown, otherwise pad_added_cb might try to
|
||||||
|
@ -3628,9 +3633,6 @@ finish_unprepare (GstRTSPMedia * media)
|
||||||
|
|
||||||
media_streams_set_blocked (media, FALSE);
|
media_streams_set_blocked (media, FALSE);
|
||||||
|
|
||||||
if (priv->status != GST_RTSP_MEDIA_STATUS_UNPREPARING)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < priv->streams->len; i++) {
|
for (i = 0; i < priv->streams->len; i++) {
|
||||||
GstRTSPStream *stream;
|
GstRTSPStream *stream;
|
||||||
|
|
||||||
|
@ -3683,6 +3685,8 @@ finish_unprepare (GstRTSPMedia * media)
|
||||||
GST_DEBUG ("stop thread");
|
GST_DEBUG ("stop thread");
|
||||||
gst_rtsp_thread_stop (priv->thread);
|
gst_rtsp_thread_stop (priv->thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->finishing_unprepare = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called with state-lock */
|
/* called with state-lock */
|
||||||
|
|
Loading…
Reference in a new issue