]> code.delx.au - pulseaudio/commitdiff
resampler: Fix crash if 'auto' resampler chooses ffmpeg with variable rate
authorFrédéric Dalleau <frederic.dalleau@linux.intel.com>
Wed, 22 Aug 2012 13:42:16 +0000 (15:42 +0200)
committerColin Guthrie <colin@mageia.org>
Sun, 4 Nov 2012 09:07:31 +0000 (10:07 +0100)
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

src/pulsecore/resampler.c

index 38c5202da68543aff735ef9f0c8044fb790d3869..a13e700adc9d15ce46e6f0e95336cd451013acaf 100644 (file)
@@ -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
     }