From 0d525e9c85c1ebd2ed4ab809330c7605b5a8fbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Wed, 10 Jul 2013 13:10:04 +0200 Subject: [PATCH] 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. --- src/pulsecore/resampler.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 5772684ca..e5c1bb0dc 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -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;