diff options
author | Luis de Bethencourt <luis.bg@samsung.com> | 2015-01-07 18:16:12 +0000 |
---|---|---|
committer | Luis de Bethencourt <luis.bg@samsung.com> | 2015-01-07 18:16:12 +0000 |
commit | 42535107ca13d728e0679330a989590c2e0f1057 (patch) | |
tree | 422de8c6b1c7d370c723aa23d97f2ce07277b5d3 /gst/audiofx | |
parent | 1db92a91de827422eafefe08c31f9492a85cb029 (diff) |
audiodynamic: assert func_index is inside bounds
Bringing back the check removed in the previous commit but have that check be a
g_assert. Changing the function to static void since return can never be False,
because audio format will never be unkown.
Diffstat (limited to 'gst/audiofx')
-rw-r--r-- | gst/audiofx/audiodynamic.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gst/audiofx/audiodynamic.c b/gst/audiofx/audiodynamic.c index c1e70685b..399760255 100644 --- a/gst/audiofx/audiodynamic.c +++ b/gst/audiofx/audiodynamic.c @@ -180,21 +180,19 @@ gst_audio_dynamic_mode_get_type (void) return gtype; } -static gboolean +static void gst_audio_dynamic_set_process_function (GstAudioDynamic * filter, const GstAudioInfo * info) { gint func_index; - if (GST_AUDIO_INFO_FORMAT (info) == GST_AUDIO_FORMAT_UNKNOWN) - return FALSE; - func_index = (filter->mode == MODE_COMPRESSOR) ? 0 : 4; func_index += (filter->characteristics == CHARACTERISTICS_HARD_KNEE) ? 0 : 2; func_index += (GST_AUDIO_INFO_FORMAT (info) == GST_AUDIO_FORMAT_F32) ? 1 : 0; + g_assert (func_index >= 0 && func_index < G_N_ELEMENTS (process_functions)); + filter->process = process_functions[func_index]; - return TRUE; } /* GObject vmethod implementations */ @@ -330,7 +328,8 @@ gst_audio_dynamic_setup (GstAudioFilter * base, const GstAudioInfo * info) { GstAudioDynamic *filter = GST_AUDIO_DYNAMIC (base); - return gst_audio_dynamic_set_process_function (filter, info); + gst_audio_dynamic_set_process_function (filter, info); + return TRUE; } static void |