summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
m---------common0
-rw-r--r--ext/faac/gstfaac.c50
3 files changed, 40 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index e75c0638..e2bc477d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-12 Josef Zlomek <josef dot zlomek at xeris dot cz>
+
+ Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
+
+ * ext/faac/gstfaac.c: (gst_faac_sink_setcaps),
+ (gst_faac_src_setcaps), (gst_faac_chain):
+ Refcount fixes (#318659)
+
2005-10-12 Julien MOUTTE <julien@moutte.net>
* ext/Makefile.am: libvisual and snapshot are not here anymore. Makes
diff --git a/common b/common
-Subproject 37ed26e33bae9a6ab256c62ebbb9d711374a0ab
+Subproject 2485a65b662de25fb7b71857e34411426c6f530
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index fac2fd3f..3bd351ff 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -253,9 +253,10 @@ gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps)
faacEncHandle *handle;
gint channels, samplerate, depth;
gulong samples, bytes, fmt = 0, bps = 0;
+ gboolean result = FALSE;
if (!gst_caps_is_fixed (caps))
- return FALSE; /* GST_PAD_LINK_DELAYED; */
+ goto done; /* GST_PAD_LINK_DELAYED; */
if (faac->handle) {
faacEncClose (faac->handle);
@@ -272,7 +273,7 @@ gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps)
/* open a new handle to the encoder */
if (!(handle = faacEncOpen (samplerate, channels, &samples, &bytes)))
- return FALSE;
+ goto done;
switch (depth) {
case 16:
@@ -291,7 +292,7 @@ gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps)
if (!fmt) {
faacEncClose (handle);
- return FALSE;
+ goto done;
}
faac->format = fmt;
@@ -303,12 +304,18 @@ gst_faac_sink_setcaps (GstPad * pad, GstCaps * caps)
faac->samplerate = samplerate;
/* if the other side was already set-up, redo that */
- if (GST_PAD_CAPS (faac->srcpad))
- return gst_faac_src_setcaps (faac->srcpad,
+ if (GST_PAD_CAPS (faac->srcpad)) {
+ result = gst_faac_src_setcaps (faac->srcpad,
gst_pad_get_allowed_caps (faac->srcpad));
+ goto done;
+ }
/* else, that'll be done later */
- return TRUE;
+ result = TRUE;
+
+done:
+ gst_object_unref (faac);
+ return result;
}
static gboolean
@@ -316,9 +323,10 @@ gst_faac_src_setcaps (GstPad * pad, GstCaps * caps)
{
GstFaac *faac = GST_FAAC (gst_pad_get_parent (pad));
gint n;
+ gboolean result = FALSE;
if (!faac->handle || (faac->samplerate == -1 || faac->channels == -1)) {
- return FALSE;
+ goto done;
}
/* we do samplerate/channels ourselves */
@@ -363,12 +371,12 @@ gst_faac_src_setcaps (GstPad * pad, GstCaps * caps)
/* negotiate with these caps */
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, newcaps);
if (gst_pad_set_caps (faac->srcpad, newcaps) == TRUE)
- return TRUE;
- else
- return FALSE;
+ result = TRUE;
}
- return FALSE;
+done:
+ gst_object_unref (faac);
+ return result;
}
static GstFlowReturn
@@ -392,7 +400,8 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
gst_event_unref (event);
gst_buffer_unref (outbuf);
- return GST_FLOW_ERROR;
+ result = GST_FLOW_ERROR;
+ goto done;
}
if (ret_size > 0) {
@@ -407,10 +416,10 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
gst_pad_push_event (faac->srcpad, gst_event_new_eos ());
gst_pad_push (faac->srcpad, data);
- return result;
+ goto done;
default:
gst_pad_event_default (pad, event);
- return result;
+ goto done;
}
}
@@ -420,7 +429,8 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL),
("format wasn't negotiated before chain function"));
gst_buffer_unref (inbuf);
- return GST_FLOW_ERROR;
+ result = GST_FLOW_ERROR;
+ goto done;
}
if (!GST_PAD_CAPS (faac->srcpad)) {
@@ -429,7 +439,8 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
GST_ELEMENT_ERROR (faac, CORE, NEGOTIATION, (NULL),
("failed to negotiate MPEG/AAC format with next element"));
gst_buffer_unref (inbuf);
- return GST_FLOW_ERROR;
+ result = GST_FLOW_ERROR;
+ goto done;
}
}
@@ -466,7 +477,7 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
gst_buffer_unref (inbuf);
}
- return result;
+ goto done;
}
/* create the frame */
@@ -499,7 +510,8 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
GST_ELEMENT_ERROR (faac, LIBRARY, ENCODE, (NULL), (NULL));
gst_buffer_unref (inbuf);
gst_buffer_unref (subbuf);
- return GST_FLOW_ERROR;
+ result = GST_FLOW_ERROR;
+ goto done;
}
if (ret_size > 0) {
@@ -534,6 +546,8 @@ gst_faac_chain (GstPad * pad, GstBuffer * data)
gst_buffer_unref (subbuf);
}
+done:
+ gst_object_unref (faac);
return result;
}