]> code.delx.au - pulseaudio/commitdiff
resampler: Add assert to set_input/output_rate
authorpoljar (Damir Jelić) <poljarinho@gmail.com>
Wed, 10 Jul 2013 11:10:04 +0000 (13:10 +0200)
committerpoljar (Damir Jelić) <poljarinho@gmail.com>
Tue, 27 Aug 2013 10:33:10 +0000 (12:33 +0200)
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

index 5772684cad0007014bbbe20726894065143927ca..e5c1bb0dcd942a7a64af66d7cd65dec0ed7b7579 100644 (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;