diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2007-06-20 08:56:17 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2007-06-20 08:56:17 +0000 |
commit | 3dbc3b7ad1caac2e7fe319a68e3a0864d661681e (patch) | |
tree | cdf17a3f6bbeb68cb12c8caca765fb4aa10f3e16 /gst/spectrum | |
parent | 80928eba03bd6b4b7d50e14bb96524e30a7f7d54 (diff) | |
download | gst-plugins-bad-3dbc3b7ad1caac2e7fe319a68e3a0864d661681e.tar.gz gst-plugins-bad-3dbc3b7ad1caac2e7fe319a68e3a0864d661681e.tar.bz2 gst-plugins-bad-3dbc3b7ad1caac2e7fe319a68e3a0864d661681e.zip |
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.c | 5 |
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; |