summaryrefslogtreecommitdiff
path: root/gst/spectrum
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-02-15 21:34:28 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-02-15 21:34:28 -0500
commitb8142bde0703b7c60aa1e70c2da62dde6ea661ff (patch)
treefe1f2a12bd2e098681739adb1221e222cd80d68d /gst/spectrum
parentf5ef99fe5ee2d594fb876ba63c1dcd28d4d7d629 (diff)
downloadgstreamer-plugins-good-b8142bde0703b7c60aa1e70c2da62dde6ea661ff.tar.gz
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). https://bugzilla.gnome.org/show_bug.cgi?id=744213
Diffstat (limited to 'gst/spectrum')
-rw-r--r--gst/spectrum/gstspectrum.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c
index 72242dc3a..563c4f0ad 100644
--- a/gst/spectrum/gstspectrum.c
+++ b/gst/spectrum/gstspectrum.c
@@ -201,7 +201,7 @@ gst_spectrum_class_init (GstSpectrumClass * klass)
g_object_class_install_property (gobject_class, PROP_BANDS,
g_param_spec_uint ("bands", "Bands", "Number of frequency bands",
- 0, G_MAXUINT, DEFAULT_BANDS,
+ 2, ((guint) G_MAXINT + 2) / 2, DEFAULT_BANDS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_THRESHOLD,