audio-resampler: estimate memory usage in auto mode

Estimate the memory usage and use this to decide between full or
interpolated filter.
This commit is contained in:
Wim Taymans 2016-03-28 15:37:36 +02:00
parent f8e4c801eb
commit 19f7d9ca46

View file

@ -1276,6 +1276,11 @@ resampler_calculate_taps (GstAudioResampler * resampler)
resampler->filter_mode = GST_AUDIO_RESAMPLER_FILTER_MODE_FULL;
GST_DEBUG ("automatically selected full filter, %d <= %d", out_rate,
oversample);
} else if (bps * n_taps * out_rate < resampler->filter_threshold) {
/* switch to full filter when memory is below threshold */
resampler->filter_mode = GST_AUDIO_RESAMPLER_FILTER_MODE_FULL;
GST_DEBUG ("automatically selected full filter, memory %d <= %d",
bps * n_taps * out_rate, resampler->filter_threshold);
} else {
GST_DEBUG ("automatically selected interpolated filter");
resampler->filter_mode = GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED;