From: Stefan Kost Date: Fri, 12 Aug 2011 14:57:49 +0000 (+0200) Subject: spectrascope: make a copy of the audiodata before downmixing and windowing X-Git-Tag: 1.19.3~507^2~16043^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=058c63d1852fc5b3b92e88b1588433d5b11dc7f1;p=platform%2Fupstream%2Fgstreamer.git spectrascope: make a copy of the audiodata before downmixing and windowing The buffers come from the adapter and the data might overlap. We don't want to modify it in place. --- diff --git a/gst/audiovisualizers/gstspectrascope.c b/gst/audiovisualizers/gstspectrascope.c index 9ab5419833..4ebc7a15b2 100644 --- a/gst/audiovisualizers/gstspectrascope.c +++ b/gst/audiovisualizers/gstspectrascope.c @@ -165,7 +165,8 @@ gst_spectra_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio, { GstSpectraScope *scope = GST_SPECTRA_SCOPE (bscope); guint32 *vdata = (guint32 *) GST_BUFFER_DATA (video); - gint16 *adata = (gint16 *) GST_BUFFER_DATA (audio); + gint16 *adata = (gint16 *) g_memdup (GST_BUFFER_DATA (audio), + GST_BUFFER_SIZE (audio)); GstFFTS16Complex *fdata = scope->freq_data; guint x, y, off; guint l, h = bscope->height - 1; @@ -190,6 +191,7 @@ gst_spectra_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio, /* run fft */ gst_fft_s16_window (scope->fft_ctx, adata, GST_FFT_WINDOW_HAMMING); gst_fft_s16_fft (scope->fft_ctx, adata, fdata); + g_free (adata); /* draw lines */ for (x = 0; x < bscope->width; x++) {