From: Eunhae Choi Date: Wed, 16 Jan 2019 11:29:15 +0000 (+0900) Subject: hlsdemux: resolve deadlock issue X-Git-Tag: accepted/tizen/unified/20220217.153506~2^2~10^2~9^2~12^2~2^2~97 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f7ae52c9292fda690832f2d4b02408a091930a2;p=platform%2Fupstream%2Fgstreamer.git hlsdemux: resolve deadlock issue - manifest_lock is required by the mq loop task during reconfiguration of pipeline. To avoid deadlock situation with mq loop task, the manifest_lock have to be unlocked before pushing serialized event to mq. Change-Id: I11ff73ddbeb56bc7d9e4546d7234540608d3165e --- diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 85a65d6..1f7bf4e 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -115,10 +115,6 @@ static gboolean gst_hls_demux_get_live_seek_range (GstAdaptiveDemux * demux, static GstM3U8 *gst_hls_demux_stream_get_m3u8 (GstHLSDemuxStream * hls_stream); static void gst_hls_demux_set_current_variant (GstHLSDemux * hlsdemux, GstHLSVariantStream * variant); -#ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING -static void gst_hls_demux_push_fragment_finished_event (GstAdaptiveDemux * demux, - GstAdaptiveDemuxStream * stream); -#endif #define gst_hls_demux_parent_class parent_class G_DEFINE_TYPE (GstHLSDemux, gst_hls_demux, GST_TYPE_ADAPTIVE_DEMUX); @@ -1030,7 +1026,7 @@ gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux, gst_hls_demux_stream_decrypt_end (hls_stream); #ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING - gst_hls_demux_push_fragment_finished_event (demux, stream); + gst_adaptive_demux_push_fragment_finished_event (demux, stream); #endif if (stream->last_ret == GST_FLOW_OK) { if (hls_stream->pending_decrypted_buffer) { @@ -2005,19 +2001,3 @@ gst_hls_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start, return ret; } - -#ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING -static void -gst_hls_demux_push_fragment_finished_event (GstAdaptiveDemux * demux, - GstAdaptiveDemuxStream * stream) -{ - GstPad *pad = stream->pad; - GstEvent *event; - - event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, - gst_structure_new_empty ("fragment_finished")); - - GST_DEBUG_OBJECT(demux, "push fragment_finished event"); - gst_pad_push_event (pad, event); -} -#endif diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 04f4218..70a47bc 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -1082,6 +1082,24 @@ gst_adaptive_demux_stream_push_stream_start (GstAdaptiveDemux * demux, g_free (stream_id); g_free (name); } + +void +gst_adaptive_demux_push_fragment_finished_event (GstAdaptiveDemux * demux, + GstAdaptiveDemuxStream * stream) +{ + GstPad *pad = stream->pad; + GstEvent *event; + + /* to avoid deadlock during reconfiguration, + manifest_lock have to be unlocked before pushing serialized event */ + GST_MANIFEST_UNLOCK (demux); + event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, + gst_structure_new_empty ("fragment_finished")); + + GST_DEBUG_OBJECT(demux, "push fragment_finished event"); + gst_pad_push_event (pad, event); + GST_MANIFEST_LOCK (demux); +} #endif /* must be called with manifest_lock taken */ diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h index 8c2c658..b422812 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h @@ -530,6 +530,9 @@ GDateTime *gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux); #ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING gboolean gst_adaptive_demux_stream_check_switch_pad (GstAdaptiveDemuxStream * stream, GstCaps * caps, GstAdaptiveDemuxStreamCreatePadFunc create_pad_func); + +void gst_adaptive_demux_push_fragment_finished_event (GstAdaptiveDemux * demux, + GstAdaptiveDemuxStream * stream); #endif G_END_DECLS