funnel: Release object lock before pushing EOS event

When releasing a pad, if all other pads are EOS, then release
the object lock before sending an EOS.
This commit is contained in:
Olivier Crête 2012-05-31 13:24:08 -04:00
parent f3b2dd6fa1
commit 5431af5415

View file

@ -256,6 +256,7 @@ gst_funnel_release_pad (GstElement * element, GstPad * pad)
{ {
GstFunnel *funnel = GST_FUNNEL (element); GstFunnel *funnel = GST_FUNNEL (element);
GstFunnelPad *fpad = GST_FUNNEL_PAD_CAST (pad); GstFunnelPad *fpad = GST_FUNNEL_PAD_CAST (pad);
gboolean send_eos = FALSE;
GST_DEBUG_OBJECT (funnel, "releasing pad"); GST_DEBUG_OBJECT (funnel, "releasing pad");
@ -264,25 +265,15 @@ gst_funnel_release_pad (GstElement * element, GstPad * pad)
gst_element_remove_pad (GST_ELEMENT_CAST (funnel), pad); gst_element_remove_pad (GST_ELEMENT_CAST (funnel), pad);
GST_OBJECT_LOCK (funnel); GST_OBJECT_LOCK (funnel);
if (fpad->got_eos) { if (!fpad->got_eos && gst_funnel_all_sinkpads_eos_unlocked (funnel)) {
GST_DEBUG_OBJECT (funnel, GST_DEBUG_OBJECT (funnel, "Pad removed. All others are EOS. Sending EOS");
"Pad removed, but was EOS. Skip checking other pads for EOS"); send_eos = TRUE;
goto out;
} }
if (!gst_funnel_all_sinkpads_eos_unlocked (funnel)) {
GST_DEBUG_OBJECT (funnel,
"Pad removed, but not all others are EOS. Not sending EOS");
goto out;
}
GST_DEBUG_OBJECT (funnel, "Pad removed. All others are EOS. Sending EOS");
if (!gst_pad_push_event (funnel->srcpad, gst_event_new_eos ()))
GST_WARNING_OBJECT (funnel, "Failure pushing EOS");
out:
GST_OBJECT_UNLOCK (funnel); GST_OBJECT_UNLOCK (funnel);
if (send_eos)
if (!gst_pad_push_event (funnel->srcpad, gst_event_new_eos ()))
GST_WARNING_OBJECT (funnel, "Failure pushing EOS");
} }
static GstCaps * static GstCaps *