This way the fix method function should be more readable and easier to expand in the future. --- src/pulsecore/resampler.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 35bcaf9..b3bbb18 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -213,14 +213,16 @@ static pa_resample_method_t pa_resampler_fix_method( method = PA_RESAMPLER_AUTO; } - if (method == PA_RESAMPLER_FFMPEG && (flags & PA_RESAMPLER_VARIABLE_RATE)) { - pa_log_info("Resampler 'ffmpeg' cannot do variable rate, reverting to resampler 'auto'."); - method = PA_RESAMPLER_AUTO; - } - - if (method == PA_RESAMPLER_COPY && ((flags & PA_RESAMPLER_VARIABLE_RATE) || a->rate != b->rate)) { - pa_log_info("Resampler 'copy' cannot change sampling rate, reverting to resampler 'auto'."); - method = PA_RESAMPLER_AUTO; + switch (method) { + case PA_RESAMPLER_COPY: /* fall through */ + case PA_RESAMPLER_FFMPEG: + if (flags & PA_RESAMPLER_VARIABLE_RATE) { + pa_log_info("Resampler '%s' cannot do variable rate, reverting to resampler 'auto'.", pa_resample_method_to_string(method)); + method = PA_RESAMPLER_AUTO; + } + break; + default: + break; } if (method == PA_RESAMPLER_AUTO) { -- 1.8.3.2