From da19a3c21a5e063e0175a16d572382f88cf4714d Mon Sep 17 00:00:00 2001 From: Ognyan Tonchev Date: Sat, 12 Apr 2014 05:57:00 +0200 Subject: [PATCH] media: stop the thread in more error cases --- gst/rtsp-server/rtsp-media.c | 12 ++++++++++++ tests/check/gst/media.c | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index b827c7279b..e8b1cb1dc7 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -2258,6 +2258,9 @@ was_prepared: /* ERRORS */ not_unprepared: { + /* we are not going to use the giving thread, so stop it. */ + if (thread) + gst_rtsp_thread_stop (thread); GST_WARNING ("media %p was not unprepared", media); priv->prepare_count--; g_rec_mutex_unlock (&priv->state_lock); @@ -2265,6 +2268,9 @@ not_unprepared: } is_reused: { + /* we are not going to use the giving thread, so stop it. */ + if (thread) + gst_rtsp_thread_stop (thread); priv->prepare_count--; g_rec_mutex_unlock (&priv->state_lock); GST_WARNING ("can not reuse media %p", media); @@ -2272,6 +2278,9 @@ is_reused: } no_create_rtpbin: { + /* we are not going to use the giving thread, so stop it. */ + if (thread) + gst_rtsp_thread_stop (thread); priv->prepare_count--; g_rec_mutex_unlock (&priv->state_lock); GST_ERROR ("no create_rtpbin function"); @@ -2280,6 +2289,9 @@ no_create_rtpbin: } no_rtpbin: { + /* we are not going to use the giving thread, so stop it. */ + if (thread) + gst_rtsp_thread_stop (thread); priv->prepare_count--; g_rec_mutex_unlock (&priv->state_lock); GST_WARNING ("no rtpbin element"); diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c index e06a4ddc0c..f2a58cedd4 100644 --- a/tests/check/gst/media.c +++ b/tests/check/gst/media.c @@ -205,7 +205,6 @@ GST_START_TEST (test_media_prepare) "( videotestsrc is-live=true ! rtpvrawpay pt=96 name=pay0 )"); g_object_unref (pool); - gst_rtsp_thread_stop (thread); gst_rtsp_thread_pool_cleanup (); }