summaryrefslogtreecommitdiffstats
path: root/gst/spectrum
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sourceforge.net>2007-06-20 08:56:17 +0000
committerStefan Kost <ensonic@users.sourceforge.net>2007-06-20 08:56:17 +0000
commit048a15698d8c0d8f75e9fc42a220dc1e47b9223f (patch)
treee6f57614bdd5b55b2a2cd50c64f58b2b0440df20 /gst/spectrum
parent42ca9c44e6171d1c5e80f052c837efdf8c602311 (diff)
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.
Diffstat (limited to 'gst/spectrum')
-rw-r--r--gst/spectrum/gstspectrum.c5
1 files changed, 3 insertions, 2 deletions
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;