From: Wim Taymans Date: Thu, 3 Nov 2005 12:32:09 +0000 (+0000) Subject: gst/playback/gstdecodebin.c: Handle the case where a pad_block failed. X-Git-Tag: 1.19.3~511^2~12587 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e48aa490cad8d3a9a0ac88e8d75ed2afc47fdc6;p=platform%2Fupstream%2Fgstreamer.git gst/playback/gstdecodebin.c: Handle the case where a pad_block failed. Original commit message from CVS: * gst/playback/gstdecodebin.c: (gst_decode_bin_init), (gst_decode_bin_dispose), (free_dynamics), (remove_fakesink), (pad_blocked), (close_pad_link), (new_pad), (no_more_pads): Handle the case where a pad_block failed. --- diff --git a/ChangeLog b/ChangeLog index 6692f06..b675460 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-11-03 Wim Taymans + + * gst/playback/gstdecodebin.c: (gst_decode_bin_init), + (gst_decode_bin_dispose), (free_dynamics), (remove_fakesink), + (pad_blocked), (close_pad_link), (new_pad), (no_more_pads): + Handle the case where a pad_block failed. + 2005-11-02 Sebastien Cote reviewed by: Zeeshan Ali diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index d5a012a..40c50df 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -480,15 +480,9 @@ mimetype_is_raw (const gchar * mimetype) } static void -pad_unblocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin) +remove_fakesink (GstDecodeBin * decode_bin) { -} - -static void -pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin) -{ - decode_bin->numwaiting--; - if (decode_bin->numwaiting == 0 && decode_bin->fakesink) { + if (decode_bin->fakesink) { gst_object_ref (decode_bin->fakesink); gst_bin_remove (GST_BIN (decode_bin), decode_bin->fakesink); @@ -502,8 +496,19 @@ pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin) gst_element_post_message (GST_ELEMENT_CAST (decode_bin), gst_message_new_state_dirty (GST_OBJECT_CAST (decode_bin))); } - gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_unblocked, - NULL); +} + +static void +pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin) +{ + if (blocked) { + decode_bin->numwaiting--; + if (decode_bin->numwaiting == 0) { + remove_fakesink (decode_bin); + } + gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_blocked, + NULL); + } } /* given a pad and a caps from an element, find the list of elements @@ -559,14 +564,15 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps, /* make a unique name for this new pad */ padname = g_strdup_printf ("src%d", decode_bin->numpads); decode_bin->numpads++; - decode_bin->numwaiting++; /* make it a ghostpad */ ghost = gst_ghost_pad_new (padname, pad); gst_element_add_pad (GST_ELEMENT (decode_bin), ghost); - gst_pad_set_blocked_async (pad, TRUE, (GstPadBlockCallback) pad_blocked, - decode_bin); + if (gst_pad_set_blocked_async (pad, TRUE, (GstPadBlockCallback) pad_blocked, + decode_bin)) { + decode_bin->numwaiting++; + } GST_LOG_OBJECT (element, "closed pad %s", padname); @@ -898,10 +904,14 @@ no_more_pads (GstElement * element, GstDynamic * dynamic) /* if we have no more dynamic elements, we have no chance of creating * more pads, so we fire the no_more_pads signal */ if (decode_bin->dynamics == NULL) { + if (decode_bin->numwaiting == 0) { + GST_DEBUG_OBJECT (decode_bin, + "no more dynamic elements, removing fakesink"); + remove_fakesink (decode_bin); + } GST_DEBUG_OBJECT (decode_bin, "no more dynamic elements, signaling no_more_pads"); gst_element_no_more_pads (GST_ELEMENT (decode_bin)); - } else { GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements"); }