pierr3 / VectorAudio

An Audio-For-VATSIM ATC Client for macOS, Linux and Windows
GNU General Public License v3.0
47 stars 11 forks source link

Linux audio reliability #78

Closed minsulander closed 10 months ago

minsulander commented 11 months ago

I'm using VectorAudio 1.4.0 on Linux (Ubuntu 22.04) with a USB headset and noticed that if you:

  1. Configure VectorAudio with Sound API set to PulseAudio (none of the other options work for me)
  2. Have it running just fine, sending and receiving, happy camper
  3. Have an unreliable USB hub temporarily reset your devices (can be simulated by pulling the USB plug of the headset out and inserting it again)
  4. Now you have no audio but also no indication that there's something wrong (other than seeing Last RX: flashing around without hearing anything), and you end up missing transmissions. Bad controller.

In that situation it would be nice if VectorAudio showed some large error banner, or disconnected automatically, or (even better) reset the audio device somehow to remedy the situtation by itself.

With all due respect that audio on Linux can be quite frustrating... :wink:

vector_audio.log shows this when I pull the USB plug:

[2023-10-19 23:17:34.356] [VectorAudio] [info] [afv_native] MiniAudioAudioDevice DEBUG: [Pulse] Device suspended state changed. pa_stream_is_suspended() returned 1.
[2023-10-19 23:17:34.356] [VectorAudio] [info] [afv_native] MiniAudioAudioDevice DEBUG: [Pulse] Device suspended state changed. Suspended.
[2023-10-19 23:17:34.356] [VectorAudio] [info] [afv_native] MiniAudioAudioDevice DEBUG: [Pulse] Device suspended state changed. pa_stream_is_suspended() returned 1.
[2023-10-19 23:17:34.356] [VectorAudio] [info] [afv_native] MiniAudioAudioDevice DEBUG: [Pulse] Device suspended state changed. Suspended.

so there should be something to hook into to trigger some error handling behavior..

pierr3 commented 11 months ago

Sounds like the best bugfix would be to get a reliable USB hub ;)

Could you please share your log file so I can a look at if there is even anything reported ?

Thanks

pierr3 commented 11 months ago

Wrote too quickly and did not see your edit, thank you.

minsulander commented 11 months ago

Yes indeed, I need a new USB hub, but it would still be nice if VectorAudio indicated that audio is not working.. could happen for other reasons, say, if my cat (if I had one) tripped on the USB cable and pulled it out without me noticing... :laughing: There might be more plausible cases.

pierr3 commented 10 months ago

I found a way to add that notification. Will be available in the next version

minsulander commented 10 months ago

Awesome! Thanks a bunch.

pierr3 commented 10 months ago

I added an event for this, but to be very honest it might still crash haha, give it a try and we will see. Pulse audio does behave strangely. For example on macOs, coreaudio would automatically rerouted everything to default active devices. Let me know how it goes

minsulander commented 10 months ago

Thanks for looking into this. I haven't had a chance to try out the latest version yet, but I will as soon as I can, and let you know.

minsulander commented 10 months ago

Wonderful! Now I get this error dialog when I (or my USB hub) disconnect the headset: image

Although... when I click OK, the dialog closes and then the whole app freezes. But this is so much better because at least I know I have a problem, and I can kill it and restart/reconnect.

pierr3 commented 10 months ago

Great, going to close this as "good enough", will see I'll manage to fix the freeze in the future