Closed KynikossDragonn closed 6 months ago
I found some time to look into this. However, I must admit that I never got pipewire working on my system and this time wasn't any different (error: PipeWire stream connection failed
).
Unfortunately, I don't see what causes this error either. The audio driver is created here: https://github.com/FluidSynth/fluidsynth/blob/eabae3be191279afa3a0221f581d61672732d021/src/fluidsynth.c#L1135
and destroyed here: https://github.com/FluidSynth/fluidsynth/blob/eabae3be191279afa3a0221f581d61672732d021/src/fluidsynth.c#L1198
Both is done by the main-thread. I'd welcome a PR for this.
I can reproduce this on my machine with pipewire 1.0.3 and FluidSynth 2.3.4. No errors when playing a MIDI file and exiting via CTRL-C
, but when I type in "quit" into the interactive shell the above mentioned errors are shown.
When I add code to stop the thread loop before destroying the stream, I don't see any errors from pipewire anymore.
Actually, the correct fix seems to be to grab the thread lock before destroying the stream. The error message even hints at that: "check thread and locking". I've updated the PR accordingly.
FluidSynth version
Describe the bug
Various PipeWire functions related to destroying the context produce numerous errors when FluidSynth exits or otherwise wants to destroy the audio context.
Occasionally, this can result in a segfault or abort.
Expected behavior
The PipeWire context should be cleanly removed, and not produce these error messages.
Steps to reproduce
Launch FluidSynth in a interactable shell with the PipeWire audio driver
$ fluidsynth -a pipewire
Type quit into the shellAdditional context
The Mumble project ran into similiar pitfalls; more information here: https://github.com/mumble-voip/mumble/pull/6103 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3150#note_1862593