audioiirfilter: Don't crash if no filter coefficients are provided

...and by default use a identity filter.

https://bugzilla.gnome.org/show_bug.cgi?id=710215
This commit is contained in:
Sebastian Dröge 2013-10-31 22:43:49 +01:00
parent 4f288a5234
commit 2559557ff1
2 changed files with 7 additions and 4 deletions

View file

@ -372,7 +372,11 @@ gst_audio_fx_base_iir_filter_transform_ip (GstBaseTransform * base,
if (GST_CLOCK_TIME_IS_VALID (stream_time))
gst_object_sync_values (GST_OBJECT (filter), stream_time);
g_return_val_if_fail (filter->a != NULL, GST_FLOW_ERROR);
if (filter->a == NULL || filter->b == NULL) {
g_return_val_if_fail (filter->a != NULL
&& filter->b != NULL, GST_FLOW_ERROR);
return GST_FLOW_ERROR;
}
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
num_samples = map.size / GST_AUDIO_FILTER_BPS (filter);

View file

@ -186,7 +186,7 @@ static void
gst_audio_iir_filter_init (GstAudioIIRFilter * self)
{
GValue v = { 0, };
GValueArray *a, *b;
GValueArray *a;
a = g_value_array_new (1);
@ -195,8 +195,7 @@ gst_audio_iir_filter_init (GstAudioIIRFilter * self)
g_value_array_append (a, &v);
g_value_unset (&v);
b = NULL;
gst_audio_iir_filter_update_coefficients (self, a, b);
gst_audio_iir_filter_update_coefficients (self, a, a);
g_mutex_init (&self->lock);
}