After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744213 - spectrum: assertion 'len > 0' failed
spectrum: assertion 'len > 0' failed
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
Other Linux
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2015-02-10 06:05 UTC by Vineeth
Modified: 2015-05-05 21:56 UTC
See Also:
GNOME target: ---
GNOME version: ---

fix exception when bands is 0 (1.19 KB, patch)
2015-02-10 06:07 UTC, Vineeth
none Details | Review
fix exception when bands is of high value (1.26 KB, patch)
2015-03-06 06:20 UTC, Vineeth
none Details | Review

Description Vineeth 2015-02-10 06:05:32 UTC
When bands value is given as 0 or maximum uint value, it crashes with
 ** (gst-launch-1.0:31837): CRITICAL **: gst_fft_f32_new: assertion 'len > 0' failed
 this happens because, for fft, the calculations are 
 nfft = 2 * bands - 2. Hence readjusted the min and max values of bands.
Comment 1 Vineeth 2015-02-10 06:07:34 UTC
Created attachment 296439 [details] [review]
fix exception when bands is 0
Comment 2 Nicolas Dufresne (ndufresne) 2015-02-16 02:28:04 UTC
Review of attachment 296439 [details] [review]:

::: gst/spectrum/gstspectrum.c
@@ +202,3 @@
   g_object_class_install_property (gobject_class, PROP_BANDS,
       g_param_spec_uint ("bands", "Bands", "Number of frequency bands",
+          1, G_MAXUINT / 2, DEFAULT_BANDS,

Minimum shall be 2 according to the formula you showed.

  nfft = 2 * 1 - 2 == -1

Which also triggers the assertion from testing. The upper limit is also not correct. gst_fft_32_new() takes a len argument of type signed integer. That means nfft need to be smaller or equal to G_MAXINT. That means the the maximum possible value for bands is in fact:

  ((guint)G_MAXINT + 2) / 2
Comment 3 Nicolas Dufresne (ndufresne) 2015-02-16 02:34:00 UTC
Got the explanation wrong here, min need to be two, because the number of FFTs need to be at least 1 to make any sense. 1 band would assert in gst_fft_f32_new:

assertion 'len > 0' failed
Comment 4 Nicolas Dufresne (ndufresne) 2015-02-16 02:52:15 UTC
commit b8142bde0703b7c60aa1e70c2da62dde6ea661ff
Author: Nicolas Dufresne <>
Date:   Sun Feb 15 21:34:28 2015 -0500

    spectrum: Fix min and max for bands property
    The number of FFTs is calculated with the following formula:
      guint nfft = 2 * bands - 2;
    nfft is passed to gst_fft_f32_new() as the len argument and is of type
    unsigned integer. This method required that len is at leas 1, then
    maximum G_MAXINT, as other values would be negative. If we extrapolate
    from the formula above it means we need "bands" to be between 2 and
    ((guint)G_MAXINT + 2) / 2).
Comment 5 Vineeth 2015-03-06 06:20:12 UTC
Created attachment 298686 [details] [review]
fix exception when bands is of high value

When the band value is set as maximum, it crashes with SIGSEGV

The maximum audible band range is 22421. Hence readjusting the band property max value as 22421
Comment 6 Vineeth 2015-04-20 08:19:36 UTC
Hi Nicolas,

Can you check if the modified patch is proper, as it was still crashing with the original patch.
Comment 7 Nicolas Dufresne (ndufresne) 2015-05-05 21:56:26 UTC
I don't know, theorically if you had enough RAM it would not crash so ...