Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source-built ladspa plugin used in ffmpeg segmentation fault #167

Open
w4-jihunlorenzopark opened this issue Apr 28, 2023 · 1 comment
Open

Comments

@w4-jihunlorenzopark
Copy link

Thank you for your contribution to open such an amazing work.
I built the ladspa from the current master HEAD and am trying to use it by loading in ffmpeg.
It is loaded successful, but got segmentation fault.

I attached the gdb log by your guidance from another issue: #99.

$ gdb --args ffmpeg -loglevel trace -i 01_01_001097_210818_SN_1min_48k_resample.wav -af "ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_mono:controls=50|200|0|0|0" 01_01_001097_210818_SN_1min_rnnoise.wav
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ffmpeg...
(No debugging symbols found in ffmpeg)
(gdb) run
Starting program: /usr/bin/ffmpeg -loglevel trace -i 01_01_001097_210818_SN_1min_48k_resample.wav -af ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_mono:controls=50\|200\|0\|0\|0 01_01_001097_210818_SN_1min_rnnoise.wav
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Reading option '-i' ... matched as input url with argument '01_01_001097_210818_SN_1min_48k_resample.wav'.
Reading option '-af' ... matched as option 'af' (set audio filters) with argument 'ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_mono:controls=50|200|0|0|0'.
Reading option '01_01_001097_210818_SN_1min_rnnoise.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url 01_01_001097_210818_SN_1min_48k_resample.wav.
Successfully parsed a group of options.
Opening an input file: 01_01_001097_210818_SN_1min_48k_resample.wav.
[NULL @ 0x558010636240] Opening '01_01_001097_210818_SN_1min_48k_resample.wav' for reading
[file @ 0x558010636ec0] Setting default whitelist 'file,crypto,data'
Probing mp3 score:1 size:2048
Probing wav score:99 size:2048
[wav @ 0x558010636240] Format wav probed with size=2048 and score=99
[wav @ 0x558010636240] Before avformat_find_stream_info() pos: 44 bytes read:65580 seeks:1 nb_streams:1
[wav @ 0x558010636240] probing stream 0 pp:32
Probing mp3 score:1 size:4096
[wav @ 0x558010636240] Probe with size=4096, packets=2469 detected mp3 with score=1
[wav @ 0x558010636240] probing stream 0 pp:31
[wav @ 0x558010636240] probing stream 0 pp:30
[wav @ 0x558010636240] probing stream 0 pp:29
[wav @ 0x558010636240] probing stream 0 pp:28
[wav @ 0x558010636240] probing stream 0 pp:27
[wav @ 0x558010636240] probing stream 0 pp:26
[wav @ 0x558010636240] probing stream 0 pp:25
[wav @ 0x558010636240] probing stream 0 pp:24
[wav @ 0x558010636240] probing stream 0 pp:23
[wav @ 0x558010636240] probing stream 0 pp:22
[wav @ 0x558010636240] probing stream 0 pp:21
[wav @ 0x558010636240] probing stream 0 pp:20
[wav @ 0x558010636240] probing stream 0 pp:19
[wav @ 0x558010636240] probing stream 0 pp:18
[wav @ 0x558010636240] probing stream 0 pp:17
[wav @ 0x558010636240] probing stream 0 pp:16
[wav @ 0x558010636240] probing stream 0 pp:15
[wav @ 0x558010636240] probing stream 0 pp:14
[wav @ 0x558010636240] probing stream 0 pp:13
[wav @ 0x558010636240] probing stream 0 pp:12
[wav @ 0x558010636240] probing stream 0 pp:11
[wav @ 0x558010636240] probing stream 0 pp:10
[wav @ 0x558010636240] probing stream 0 pp:9
[wav @ 0x558010636240] probing stream 0 pp:8
[wav @ 0x558010636240] probing stream 0 pp:7
[wav @ 0x558010636240] probing stream 0 pp:6
[wav @ 0x558010636240] probing stream 0 pp:5
[wav @ 0x558010636240] probing stream 0 pp:4
[wav @ 0x558010636240] probing stream 0 pp:3
[wav @ 0x558010636240] probing stream 0 pp:2
[wav @ 0x558010636240] probing stream 0 pp:1
[wav @ 0x558010636240] probed stream 0
[wav @ 0x558010636240] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 0x558010636240] All info found
[wav @ 0x558010636240] stream 0: start_time: NOPTS duration: 65.306
[wav @ 0x558010636240] format: start_time: NOPTS duration: 65.306 (estimate from stream) bitrate=768 kb/s
[wav @ 0x558010636240] After avformat_find_stream_info() pos: 204844 bytes read:294956 seeks:1 frames:50
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '01_01_001097_210818_SN_1min_48k_resample.wav':
  Duration: 00:01:05.31, bitrate: 768 kb/s
  Stream #0:0, 50, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Successfully opened the file.
Parsing a group of options: output url 01_01_001097_210818_SN_1min_rnnoise.wav.
Applying option af (set audio filters) with argument ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_mono:controls=50|200|0|0|0.
Successfully parsed a group of options.
Opening an output file: 01_01_001097_210818_SN_1min_rnnoise.wav.
File '01_01_001097_210818_SN_1min_rnnoise.wav' already exists. Overwrite? [y/N] y
[file @ 0x55801063a400] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
detected 6 logical cores
[New Thread 0x7fee3eef5640 (LWP 10721)]
[New Thread 0x7fee3e6f4640 (LWP 10722)]
[New Thread 0x7fee3def3640 (LWP 10723)]
[New Thread 0x7fee3d6f2640 (LWP 10724)]
[New Thread 0x7fee3cef1640 (LWP 10725)]
[New Thread 0x7fee3c6f0640 (LWP 10726)]
[Parsed_ladspa_0 @ 0x5580106852c0] Setting 'file' to value 'librnnoise_ladspa'
[Parsed_ladspa_0 @ 0x5580106852c0] Setting 'plugin' to value 'noise_suppressor_mono'
[Parsed_ladspa_0 @ 0x5580106852c0] Setting 'controls' to value '50|200|0|0|0'
[Parsed_ladspa_0 @ 0x5580106852c0] ports: 7
[Parsed_ladspa_0 @ 0x5580106852c0] inputs: 1 outputs: 1
[Parsed_ladspa_0 @ 0x5580106852c0] input controls: 5 output controls: 0
[graph_0_in_0_0 @ 0x558010686f80] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x558010686f80] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x558010686f80] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0x558010686f80] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 0x558010686f80] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x4
[format_out_0_0 @ 0x558010687140] Setting 'sample_fmts' to value 's16'
[Parsed_ladspa_0 @ 0x5580106852c0] auto-inserting filter 'auto_resampler_0' between the filter 'graph_0_in_0_0' and the filter 'Parsed_ladspa_0'
[format_out_0_0 @ 0x558010687140] auto-inserting filter 'auto_resampler_1' between the filter 'Parsed_ladspa_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0x558010683ec0] query_formats: 4 queried, 3 merged, 6 already done, 0 delayed
[auto_resampler_0 @ 0x558010688c80] [SWR @ 0x558010689140] Using s16p internally between filters
[auto_resampler_0 @ 0x558010688c80] ch:1 chl:mono fmt:s16 r:48000Hz -> ch:1 chl:mono fmt:fltp r:48000Hz
[Parsed_ladspa_0 @ 0x5580106852c0] handles: 1
[auto_resampler_1 @ 0x55801069e440] [SWR @ 0x55801069e7c0] Using fltp internally between filters
[auto_resampler_1 @ 0x55801069e440] ch:1 chl:mono fmt:fltp r:48000Hz -> ch:1 chl:mono fmt:s16 r:48000Hz

Thread 1 "ffmpeg" received signal SIGSEGV, Segmentation fault.
0x00007fee3beccb9b in check_init () from /usr/local/lib/ladspa/librnnoise_ladspa.so
(gdb) bt
#0  0x00007fee3beccb9b in check_init () at /usr/local/lib/ladspa/librnnoise_ladspa.so
#1  0x00007fee3becd864 in rnnoise_process_frame () at /usr/local/lib/ladspa/librnnoise_ladspa.so
#2  0x00007fee3becb01c in RnNoiseCommonPlugin::process(float const* const*, float**, unsigned long, float, unsigned int, unsigned int) () at /usr/local/lib/ladspa/librnnoise_ladspa.so
#3  0x00007fee3bec9cea in ladspa::builder<RnNoiseMono>::_run(void*, unsigned long) () at /usr/local/lib/ladspa/librnnoise_ladspa.so
#4  0x00007fee4c27b5b2 in  () at /lib/x86_64-linux-gnu/libavfilter.so.7
#5  0x00007fee4c2b4509 in  () at /lib/x86_64-linux-gnu/libavfilter.so.7
#6  0x00007fee4c2b9310 in av_buffersrc_add_frame_flags () at /lib/x86_64-linux-gnu/libavfilter.so.7
#7  0x000055800ed8412d in  ()
#8  0x000055800ed84c40 in  ()
#9  0x000055800ed86a78 in  ()
#10 0x000055800ed5fe67 in main ()

Reproducibility

I am using ubuntu 22.04 docker image with i7 cpu which is x86/64. My image was basically built on top of this image #11 (comment) and my only change is replacing the ubuntu version to 22.04. (And additionally, for successful build, I installed libasound2-dev libjack-jackd2-dev libcurl4-openssl-dev libfreetype6-dev libx11-dev libxcomposite-dev libxcursor-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev libwebkit2gtk-4.0-dev)
My command to trigger segmentation fault was

ffmpeg -loglevel trace -i 01_01_001097_210818_SN_1min_48k_resample.wav -af "ladspa=file=librnnoise_ladspa:plugin=noise_suppressor_mono:controls=50|200|0|0|0" 01_01_001097_210818_SN_1min_rnnoise.wav
@richardpl
Copy link

Use native ffmpeg filter: arnndn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants