GNOME Bugzilla – Bug 744213
spectrum: assertion 'len > 0' failed
Last modified: 2015-05-05 21:56:26 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.
Created attachment 296439 [details] [review]
fix exception when bands is 0
Review of attachment 296439 [details] [review]:
@@ +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
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
Author: Nicolas Dufresne <firstname.lastname@example.org>
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).
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
Can you check if the modified patch is proper, as it was still crashing with the original patch.
I don't know, theorically if you had enough RAM it would not crash so ...