summaryrefslogtreecommitdiffstats
path: root/gst/id3demux
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2007-03-06 23:19:30 +0000
committerTim-Philipp Müller <tim@centricular.net>2007-03-06 23:19:30 +0000
commit009c9750ea535fca5fea1df3fbaf7aa691e962e6 (patch)
tree80c5a098ac0de7f9d560f37cd76c5840bff45667 /gst/id3demux
parentcc09b81c01afb8100f1f4d98060f79ebd766878e (diff)
gst/id3demux/gstid3demux.c: Don't leak caps: make gst_id3demux_add_srcpad() not take ownership of the caps passed to ...
Original commit message from CVS: * gst/id3demux/gstid3demux.c: (gst_id3demux_add_srcpad), (gst_id3demux_sink_activate): Don't leak caps: make gst_id3demux_add_srcpad() not take ownership of the caps passed to it (previouslly one code path assumes it takes ownership while another one assumes it doesn't). * configure.ac: * tests/files/Makefile.am: * tests/files/id3-407349-1.tag: * tests/files/id3-407349-2.tag: Add directory where data for unit tests can be stored. * tests/Makefile.am: * tests/check/Makefile.am: * tests/check/elements/.cvsignore: * tests/check/elements/id3demux.c: (pad_added_cb), (error_cb), (read_tags_from_file), (run_check_for_file), (check_date_1977_06_23), (GST_START_TEST), (id3demux_suite): Add unit test for id3demux, and in particular for bug #407349. Only testing pull-mode for now; push mode doesn't work yet because the test files are smaller than ID3_TYPE_FIND_MIN_SIZE.
Diffstat (limited to 'gst/id3demux')
-rw-r--r--gst/id3demux/gstid3demux.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gst/id3demux/gstid3demux.c b/gst/id3demux/gstid3demux.c
index 469514f9..886264f6 100644
--- a/gst/id3demux/gstid3demux.c
+++ b/gst/id3demux/gstid3demux.c
@@ -106,7 +106,7 @@ static GstFlowReturn gst_id3demux_src_getrange (GstPad * srcpad,
guint64 offset, guint length, GstBuffer ** buffer);
static gboolean gst_id3demux_add_srcpad (GstID3Demux * id3demux,
- GstCaps * new_caps);
+ const GstCaps * new_caps);
static gboolean gst_id3demux_remove_srcpad (GstID3Demux * id3demux);
static gboolean gst_id3demux_srcpad_event (GstPad * pad, GstEvent * event);
@@ -239,12 +239,12 @@ gst_id3demux_dispose (GObject * object)
}
static gboolean
-gst_id3demux_add_srcpad (GstID3Demux * id3demux, GstCaps * new_caps)
+gst_id3demux_add_srcpad (GstID3Demux * id3demux, const GstCaps * new_caps)
{
if (id3demux->src_caps == NULL ||
!gst_caps_is_equal (new_caps, id3demux->src_caps)) {
- gst_caps_replace (&(id3demux->src_caps), new_caps);
+ gst_caps_replace (&(id3demux->src_caps), (GstCaps *) new_caps);
if (id3demux->srcpad != NULL) {
GST_DEBUG_OBJECT (id3demux, "Changing src pad caps to %" GST_PTR_FORMAT,
id3demux->src_caps);
@@ -252,8 +252,7 @@ gst_id3demux_add_srcpad (GstID3Demux * id3demux, GstCaps * new_caps)
gst_pad_set_caps (id3demux->srcpad, id3demux->src_caps);
}
} else {
- /* Caps never changed */
- gst_caps_unref (new_caps);
+ /* caps didn't change */
}
if (id3demux->srcpad == NULL) {
@@ -909,7 +908,6 @@ gst_id3demux_sink_activate (GstPad * sinkpad)
id3demux->state = GST_ID3DEMUX_STREAMING;
/* 6 Add the srcpad for output now we know caps. */
- /* add_srcpad takes ownership of the caps */
if (!gst_id3demux_add_srcpad (id3demux, caps)) {
GST_DEBUG_OBJECT (id3demux, "Could not add source pad");
goto done_activate;
@@ -925,6 +923,9 @@ gst_id3demux_sink_activate (GstPad * sinkpad)
done_activate:
+ if (caps)
+ gst_caps_unref (caps);
+
return ret;
}