wwmm / easyeffects

Limiter, compressor, convolver, equalizer and auto volume and many other plugins for PipeWire applications
GNU General Public License v3.0
6.48k stars 269 forks source link

flatpak version crashes on each startup if i increase pipewire latency #2417

Open Ghoost666 opened 1 year ago

Ghoost666 commented 1 year ago

EasyEffects Version

7.0.4

What package are you using?

Flatpak (Flathub)

Distribution

Fedora 38

Describe the bug

I have sometimes xruns if i open a other application so i tried to increase pipewire buffers further from: default quantum: 8191 min quantum: 8192 max quantum: 16384 quantum limit: 32768 to: default quantum: 16384 min quantum: 16384 max quantum: 32768 quantum limit: 65536

but after rebooting the flatpak version crashes on each startup, this is not the case with the same 7.0.4 version from the fedora repositorys, the debug log seems to give no hint whatsoever

Expected Behavior

Not Crashing

Debug Log

Debug Log
``` [ghost@fedora ~]$ G_MESSAGES_DEBUG=easyeffects /usr/bin/flatpak run --branch=stable --arch=x86_64 com.github.wwmm.easyeffects (process:2): easyeffects-DEBUG: 15:09:30.265: easyeffects.cpp:35 easyeffects version: 7.0.4 (process:2): easyeffects-DEBUG: 15:09:30.266: easyeffects.cpp:45 locale directory: /app/share/locale (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:49 system input presets directory: "/app/etc/xdg/easyeffects/input"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:49 system input presets directory: "/etc/easyeffects/input"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:49 system input presets directory: "/etc/xdg/easyeffects/input"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:52 system output presets directory: "/app/etc/xdg/easyeffects/output"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:52 system output presets directory: "/etc/easyeffects/output"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:52 system output presets directory: "/etc/xdg/easyeffects/output"; (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:194 user presets directory already exists: /home/ghost/.var/app/com.github.wwmm.easyeffects/config/easyeffects/ (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:194 user presets directory already exists: /home/ghost/.var/app/com.github.wwmm.easyeffects/config/easyeffects/input (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:194 user presets directory already exists: /home/ghost/.var/app/com.github.wwmm.easyeffects/config/easyeffects/output (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:194 user presets directory already exists: /home/ghost/.var/app/com.github.wwmm.easyeffects/config/easyeffects/autoload/input (easyeffects:2): easyeffects-DEBUG: 15:09:30.270: presets_manager.cpp:194 user presets directory already exists: /home/ghost/.var/app/com.github.wwmm.easyeffects/config/easyeffects/autoload/output (easyeffects:2): easyeffects-DEBUG: 15:09:30.329: pipe_manager.cpp:1427 compiled with PipeWire: 0.3.69 (easyeffects:2): easyeffects-DEBUG: 15:09:30.329: pipe_manager.cpp:1428 linked to PipeWire: 0.3.69 (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1398 core version: 0.3.71 (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1399 core name: pipewire-0 (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1312 found metadata: settings (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1312 found metadata: default (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1312 found metadata: route-settings (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1167 Audio/Sink 42 alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1 with serial 42 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1167 Audio/Sink 45 alsa_output.pci-0000_00_1f.3.iec958-stereo with serial 45 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.340: pipe_manager.cpp:1167 Audio/Source 46 alsa_input.pci-0000_00_1f.3.analog-stereo with serial 46 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1167 Stream/Output/Audio 102 Firefox with serial 109 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1167 Audio/Sink 56 alsa_output.usb-Usb_Gadget_Usb_Gadget_000001-00.iec958-stereo with serial 126 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1167 Audio/Source 104 alsa_input.usb-Usb_Gadget_Usb_Gadget_000001-00.analog-stereo.3 with serial 127 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1207 Firefox port 106 is connected to alsa_output.usb-Usb_Gadget_Usb_Gadget_000001-00.iec958-stereo port 103 (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1207 Firefox port 105 is connected to alsa_output.usb-Usb_Gadget_Usb_Gadget_000001-00.iec958-stereo port 53 (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1167 Audio/Sink 110 easyeffects_sink with serial 222 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:1167 Audio/Source/Virtual 114 easyeffects_source with serial 223 has been added (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:900 new metadata property: 0, default.configured.audio.sink, Spa:String:JSON, { "name": "alsa_output.usb-Usb_Gadget_Usb_Gadget_000001-00.iec958-stereo" } (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:900 new metadata property: 0, default.configured.audio.source, Spa:String:JSON, {"name":"easyeffects_source"} (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:900 new metadata property: 0, default.audio.sink, Spa:String:JSON, {"name":"alsa_output.usb-Usb_Gadget_Usb_Gadget_000001-00.iec958-stereo"} (easyeffects:2): easyeffects-DEBUG: 15:09:30.341: pipe_manager.cpp:900 new metadata property: 0, default.audio.source, Spa:String:JSON, {"name":"alsa_input.usb-Usb_Gadget_Usb_Gadget_000001-00.analog-stereo.3"} (easyeffects:2): easyeffects-DEBUG: 15:09:30.342: pipe_manager.cpp:1521 easyeffects_sink node successfully retrieved with id 110 and serial 222 (easyeffects:2): easyeffects-DEBUG: 15:09:30.342: pipe_manager.cpp:1526 easyeffects_source node successfully retrieved with id 114 and serial 223 (easyeffects:2): easyeffects-DEBUG: 15:09:30.345: plugin_base.cpp:369 soe: output_level successfully connected to PipeWire graph (easyeffects:2): easyeffects-DEBUG: 15:09:30.346: plugin_base.cpp:369 soe: spectrum successfully connected to PipeWire graph (easyeffects:2): easyeffects-DEBUG: 15:09:30.349: pipe_manager.cpp:900 new metadata property: 0, default.audio.source, Spa:String:JSON, {"name":"easyeffects_source"} (easyeffects:2): easyeffects-DEBUG: 15:09:30.381: lv2_wrapper.cpp:98 http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr requires feature: http://lv2plug.in/ns/ext/urid#map (easyeffects:2): easyeffects-DEBUG: 15:09:30.602: plugin_base.cpp:369 soe: equalizer successfully connected to PipeWire graph (easyeffects:2): easyeffects-DEBUG: 15:09:30.602: pipe_manager.cpp:1207 easyeffects_sink port 112 is connected to ee_soe_equalizer port 83 (easyeffects:2): easyeffects-DEBUG: 15:09:30.603: pipe_manager.cpp:1207 easyeffects_sink port 101 is connected to ee_soe_equalizer port 77 (easyeffects:2): easyeffects-DEBUG: 15:09:30.610: plugin_base.cpp:369 soe: crossfeed successfully connected to PipeWire graph (easyeffects:2): easyeffects-DEBUG: 15:09:30.610: pipe_manager.cpp:1207 ee_soe_equalizer port 81 is connected to ee_soe_crossfeed port 75 (easyeffects:2): easyeffects-DEBUG: 15:09:30.610: pipe_manager.cpp:1207 ee_soe_equalizer port 80 is connected to ee_soe_crossfeed port 76 (easyeffects:2): easyeffects-DEBUG: 15:09:30.615: equalizer.cpp:238 soe: equalizer latency: 0.034829933 s ```

Additional Information

No response

wwmm commented 1 year ago

but after rebooting the flatpak version crashes on each startup, this is not the case with the same 7.0.4

So the native package runs fine but the one from the flatpak package crashes... As you can see in this discussion https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3198#note_1918467 at least when it comes to realtime priorities things may not always work as expected in flatpak. Maybe the larger quantum range is triggering unexpected behavior too. Whatever it is it is happening somewhere in the interaction between pipewire and flatpak. So it will probably be better to open an issue about this in PipeWire's page.

Are you sure the high values you are set are really taking effect when using the native package? If I remember well PipeWire has a maximum quantum value of 8192 hardcoded in its sources. Anything higher than this should be ignored or clamped to 8192.

wwmm commented 1 year ago

PipeWire's filters still have 8192 hardcoded as maximum quantum https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/filter.c#L28. Could it be that there is a bug in PipeWire that only happens when inside flatpak and that lets the invalid larger values to go forward? This would definitely make the filters crash. PipeWire had a bug that did something similar in the past. When it changed the sampling rate on the fly it was possible to suddenly have quantum above 8192. What made EE crash. Maybe there is something similar only inside flatpak.

Ghoost666 commented 1 year ago

Oh if pipewire has a hardcoded quantum maximum of 8192 this isnt such a big deal then i guess

but i wonder how i get rid of the xruns... they most of the time happen if i start a new program

i already tried to raise pipewire priority to nice -20... but still :(

i think the xruns started as soon as i switched to a intel 12400 from ryzen 1600

wwmm commented 1 year ago

i already tried to raise pipewire priority to nice -20... but still :(

Niceness is not going to help much. The problem that is happening in the flatpak package is that the plugins thread that should get realtime priorities (SCHED_RR instead of SCHED_OTHER) isn't getting it in some systems.

Ghoost666 commented 1 year ago

not really related to this issue, but i found the issue for 95% of xruns i got

after trying quite a lot i switched from wayland to X11 ... and xruns are nearly all gone, apparently wayland hangs the whole pc for 1-2 seconds if i start a new application which leads to 1 sec xruns

while testing i also found out with pw-top that hyperthreading/"intel speed shift technology"/"EIST" also has a influence on the "WAIT" time of the alsa output ... it went from average 8-12ms to max 3ms, also the wait time of easyeffects seems way more stable and lower now

regarding this issue... apparently if i set quantum higher then 8192 both dont work after a reboot... i had flatpak version installed, set pipewire quantum, rebooted, flatpak version crashed, installed from fedora repository, no crash but if i remember right even the fedora repository version crashed after another reboot

but overall i think the issue with the flatpak version isnt a big problem, the xruns seem to not come from easyeffects at all

wwmm commented 1 year ago

after trying quite a lot i switched from wayland to X11 ... and xruns are nearly all gone, apparently wayland hangs the whole pc for 1-2 seconds if i start a new application which leads to 1 sec xruns

I have never seen something like this. Are you also using gnome or do you use kde? For wayland vs x11 to be having such an impact either the desktop is doing something bad or maybe gtk4. Unless a very peculiar gpu driver bug is present.