resampler: Add assert to set_input/output_rate

This adds asserts to check if the implementation has an update rate
function defined for the unlikely event that some implementation forgets
to assign a update rate function we can simply bail.

It is expected from the resampling implementations to have such a
function even if the state of the resampler is completely reset.
This commit is contained in:
poljar (Damir Jelić) 2013-07-10 13:10:04 +02:00
parent 4bdfebee5c
commit 0d525e9c85

View file

@ -460,6 +460,7 @@ void pa_resampler_free(pa_resampler *r) {
void pa_resampler_set_input_rate(pa_resampler *r, uint32_t rate) {
pa_assert(r);
pa_assert(rate > 0);
pa_assert(r->impl.update_rates);
if (r->i_ss.rate == rate)
return;
@ -472,6 +473,7 @@ void pa_resampler_set_input_rate(pa_resampler *r, uint32_t rate) {
void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate) {
pa_assert(r);
pa_assert(rate > 0);
pa_assert(r->impl.update_rates);
if (r->o_ss.rate == rate)
return;