[pulseaudio-discuss] [PATCH] Use soxr_clear() if libsoxr version is 0.1.2 or later.

David Henningsson david.henningsson at canonical.com
Sun Nov 1 23:33:47 PST 2015



On 2015-10-31 16:59, Andrey Semashev wrote:
> The 0.1.2 version of libsoxr fixes soxr_process() crash after soxr_clear() is used, so check the library version at compile time and use soxr_clear() if possible.

Thanks for the patch, but if there is a bug in libsoxr that is fixed in 
0.1.2 and above, wouldn't make more sense just to depend on libsoxr >= 
0.1.2 in the configure script?

Is there a good reason for supporting older libsoxr versions?

>
> ---
>   src/pulsecore/resampler/soxr.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/pulsecore/resampler/soxr.c b/src/pulsecore/resampler/soxr.c
> index b5f0007..b1b2e19 100644
> --- a/src/pulsecore/resampler/soxr.c
> +++ b/src/pulsecore/resampler/soxr.c
> @@ -64,17 +64,17 @@ static void resampler_soxr_free(pa_resampler *r) {
>   }
>   
>   static void resampler_soxr_reset(pa_resampler *r) {
> +#if SOXR_THIS_VERSION >= SOXR_VERSION(0, 1, 2)
> +    pa_assert(r);
> +
> +    soxr_clear(r->impl.data);
> +#else
> +    /* With libsoxr prior to 0.1.2 soxr_clear() makes soxr_process() crash afterwards,
> +     * so don't use this function and re-create the context instead. */

Also, you don't seem to have added code to re-create the context?

>       soxr_t old_state;
>   
>       pa_assert(r);
>   
> -    /*
> -     * soxr_clear() makes soxr_process() crash afterwards,
> -     * so don't use this function until libsoxr is fixed.
> -     *
> -     * soxr_clear(r->impl.data);
> -     */
> -
>       old_state = r->impl.data;
>       r->impl.data = NULL;
>   
> @@ -85,6 +85,7 @@ static void resampler_soxr_reset(pa_resampler *r) {
>           r->impl.data = old_state;
>           pa_log_error("Failed to reset libsoxr context");
>       }
> +#endif
>   }
>   
>   static void resampler_soxr_update_rates(pa_resampler *r) {



More information about the pulseaudio-discuss mailing list