From 048a15698d8c0d8f75e9fc42a220dc1e47b9223f Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Wed, 20 Jun 2007 08:56:17 +0000 Subject: gst/spectrum/gstspectrum.c: Fix leaking buffers. Original commit message from CVS: * gst/spectrum/gstspectrum.c: (gst_spectrum_event), (gst_spectrum_transform_ip): Fix leaking buffers. * tests/check/Makefile.am: * tests/check/elements/spectrum.c: (setup_spectrum), (cleanup_spectrum), (GST_START_TEST), (spectrum_suite), (main): Add simple test for spectrum element. --- gst/spectrum/gstspectrum.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gst/spectrum') diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c index 3ca5a90a..75d3e2dd 100644 --- a/gst/spectrum/gstspectrum.c +++ b/gst/spectrum/gstspectrum.c @@ -396,7 +396,8 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in) GST_LOG_OBJECT (spectrum, "input size: %d bytes", GST_BUFFER_SIZE (in)); - gst_adapter_push (spectrum->adapter, gst_buffer_ref (in)); + /* can we do this nicer? */ + gst_adapter_push (spectrum->adapter, gst_buffer_copy (in)); /* required number of bytes */ wanted = spectrum->channels * SPECTRUM_WINDOW_LEN * sizeof (gint16); /* FIXME: 4.0 was 2.0 before, but that include the mirrored spectrum */ @@ -422,7 +423,7 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in) gst_spectrum_fix_loud (spectrum->loud, spectrum->re, spectrum->im, SPECTRUM_WINDOW_LEN, 0); - /* resample to requested number of bands */ + /* resample to requested number of bands and offset by threshold */ for (i = 0, pos = 0.0; i < spectrum->bands; i++, pos += step) { if (spectrum->loud[(gint) pos] > spectrum->threshold) { spect[i] = spectrum->loud[(gint) pos] - spectrum->threshold; -- cgit