summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2011-01-14 16:30:11 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2011-01-15 13:48:26 -0300
commita6a982e8be06a861e23b377d8df4e3be8538ca53 (patch)
tree9a08684320e23095848d14305a7b73a51cfa6ae3
parentf59a1d28686690ca9189ec48243479aa2cf81e6a (diff)
downloadgstreamer-plugins-bad-a6a982e8be06a861e23b377d8df4e3be8538ca53.tar.gz
audioparsers: baseparse: Be careful to not lose the event ref
Don't unref the event if it hasn't been handled, because the caller assumes it is still valid and might reuse it. I ran into this problem when transcoding an AVI (with mp3 inside) to gpp. https://bugzilla.gnome.org/show_bug.cgi?id=639555
-rw-r--r--gst/audioparsers/gstbaseparse.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gst/audioparsers/gstbaseparse.c b/gst/audioparsers/gstbaseparse.c
index 58c0ebe9e..59355c775 100644
--- a/gst/audioparsers/gstbaseparse.c
+++ b/gst/audioparsers/gstbaseparse.c
@@ -738,7 +738,10 @@ gst_base_parse_sink_event (GstPad * pad, GstEvent * event)
*
* Element-level event handler function.
*
- * Returns: TRUE if the event was handled and not need forwarding.
+ * The event will be unreffed only if it has been handled and this
+ * function returns %TRUE
+ *
+ * Returns: %TRUE if the event was handled and not need forwarding.
*/
static gboolean
gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event)
@@ -858,7 +861,9 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event)
case GST_EVENT_FLUSH_START:
parse->priv->flushing = TRUE;
- handled = gst_pad_push_event (parse->srcpad, event);
+ handled = gst_pad_push_event (parse->srcpad, gst_event_ref (event));
+ if (handled)
+ gst_event_unref (event);
/* Wait for _chain() to exit by taking the srcpad STREAM_LOCK */
GST_PAD_STREAM_LOCK (parse->srcpad);
GST_PAD_STREAM_UNLOCK (parse->srcpad);