diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-media.c b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-media.c index 2ff875be84..0ca0d9f2b1 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-media.c +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-media.c @@ -4101,6 +4101,8 @@ gst_rtsp_media_unprepare (GstRTSPMedia * media) priv->prepare_count--; if (priv->prepare_count > 0) goto is_busy; + if (priv->status == GST_RTSP_MEDIA_STATUS_UNPREPARING) + goto is_unpreparing; GST_INFO ("unprepare media %p", media); set_target_state (media, GST_STATE_NULL, FALSE); @@ -4126,6 +4128,12 @@ was_unprepared: GST_INFO ("media %p was already unprepared", media); return TRUE; } +is_unpreparing: + { + g_rec_mutex_unlock (&priv->state_lock); + GST_INFO ("media %p is already unpreparing", media); + return TRUE; + } is_busy: { GST_INFO ("media %p still prepared %d times", media, priv->prepare_count);