drowe67 / freedv-gui

GUI Application for FreeDV – open source digital voice for HF radio
https://freedv.org/
GNU Lesser General Public License v2.1
206 stars 52 forks source link

"Sample rate not supported" error causes segfault on Linux #713

Closed tmiw closed 6 months ago

tmiw commented 6 months ago

Steps to Reproduce

  1. Plug Raspberry Pi 5 into TV via HDMI.
  2. Compile FreeDV using ./build_linux.sh portaudio.
  3. Execute FreeDV and configure the speaker device to be the HDMI device (the radio device on the "Receive" tab can be any other device). "Transmit" tab is "none" for both devices.
  4. Click the Start button.

Expected Behavior

FreeDV is able to start normally. If it can't start because of a device problem, the appropriate popup should appear.

Actual Behavior

FreeDV segfaults, with the backtrace showing as somewhere inside Pa_OpenStream. Using gdb to debug causes the "Sample rate not supported" popup to appear.

SW Version Tested

FreeDV 1.9.9.1 (Git commit 0964b2b)

Tyrbiter commented 6 months ago

Might this be due to as yet immature support of the Pi 5?

tmiw commented 6 months ago

Might this be due to as yet immature support of the Pi 5?

I haven't tried with pipewire/PulseAudio yet but presumably this scenario works fine with those. When I last looked it appears to be something possibly related to the HDMI device not supporting int samples, so it may be possible to add some logic in the audio layer to just open the device as float instead and do conversion back and forth with the upper layers in the app.

Unfortunately the initial startup is already slower than I'd like and since this would just be another thing to check for...yeah. I'll have to think some more.

Tyrbiter commented 6 months ago

Are you using the Raspberry Pi OS? I assume that they are going to support older interfaces but maybe just have not got there yet. If it's a different distro then it could also be related to lack of OS development. I haven't tried to buy a Pi 5 yet, it could be down to lack of supply leading to slower development progress.

tmiw commented 6 months ago

Are you using the Raspberry Pi OS? I assume that they are going to support older interfaces but maybe just have not got there yet. If it's a different distro then it could also be related to lack of OS development. I haven't tried to buy a Pi 5 yet, it could be down to lack of supply leading to slower development progress.

Yeah, Raspberry Pi OS. Fortunately, the supply chain issues seem to have diminished, so you might be able to get one pretty easily now.

tmiw commented 6 months ago

I reflashed my Pi 5 back to aarch64, applied all available package updates and tested using both pipewire and PortAudio using an ALSA loopback device for the "input" from the radio and HDMI for output:

Considering that pipewire is quickly becoming the standard Linux audio layer (and that HDMI audio output might not be a common use in the first place), I'm considering marking this as "won't fix". On the other hand, I do know at least one FreeDV user who purposely compiles using PortAudio because they refuse to use PulseAudio or pipewire (I forget why exactly). Any feedback would be appreciated here.

Tyrbiter commented 6 months ago

I suspect it might be something to do with the original author of pulseaudio (and systemd) being persona non grata in certain people's minds.

I was actually going to suggest that portaudio use will gradually reduce as more distros move to pipewire which includes the video side of things and has better real time support too. In terms of covering the existing and future user base, won't fix is sensible in my book.

tmiw commented 6 months ago

Closed. Thanks for the feedback!