From: Frédéric Dalleau Date: Wed, 22 Aug 2012 13:42:16 +0000 (+0200) Subject: resampler: Fix crash if 'auto' resampler chooses ffmpeg with variable rate X-Git-Url: https://code.delx.au/pulseaudio/commitdiff_plain/153e17e3bb4d73ddecbf0fe5df5cca5188698c32 resampler: Fix crash if 'auto' resampler chooses ffmpeg with variable rate To reproduce, add resampler-method = ffmpeg in daemon.conf then start PA, and load module-loopback Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb2f1db40 (LWP 23047)] 0x00000000 in ?? () (gdb) bt 0 0x00000000 in ?? () 1 0xb7c463cb in pa_resampler_set_input_rate (r=0x80e9438, rate=44011) at pulsecore/resampler.c:365 2 0xb7c6321d in pa_sink_input_process_msg (o=0x80e87a0, code=3, userdata=0xabeb, offset=0, chunk=0x0) at pulsecore/sink-input.c:1833 3 0xb7e9840b in sink_input_process_msg_cb (obj=0x80e87a0, code=3, data=0xabeb, offset=0, chunk=0x0) at modules/module-loopback.c:538 4 0xb7c2709b in pa_asyncmsgq_dispatch (object=0x80e87a0, code=3, userdata=0xabeb, offset=0, memchunk=0xb2f1d17c) at pulsecore/asyncmsgq.c:322 5 0xb7c4c6e3 in asyncmsgq_read_work (i=0x80dd580) at pulsecore/rtpoll.c:564 6 0xb7c4b34a in pa_rtpoll_run (p=0x80fb7e0, wait_op=true) at pulsecore/rtpoll.c:238 7 0xb7dd90af in thread_func (userdata=0x80afe88) at modules/alsa/alsa-sink.c:1785 8 0xb7bf3291 in internal_thread_func (userdata=0x8095d08) at pulsecore/thread-posix.c:83 9 0xb7ab9d4c in start_thread (arg=0xb2f1db40) at pthread_create.c:308 10 0xb79f3ace in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130 --- diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 38c5202d..a13e700a 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -237,7 +237,10 @@ pa_resampler* pa_resampler_new( #ifdef HAVE_SPEEX method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3; #else - method = PA_RESAMPLER_FFMPEG; + if (flags & PA_RESAMPLER_VARIABLE_RATE) + method = PA_RESAMPLER_TRIVIAL; + else + method = PA_RESAMPLER_FFMPEG; #endif }