mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
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.
This commit is contained in:
parent
d576e23aa4
commit
058c63d185
1 changed files with 3 additions and 1 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Reference in a new issue