Make librespot more robust against audio failures #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using librespot with pulseaudio over TCP, connection failures always lead to panics. This patchset introduces proper error handling in the pulseaudio backend and ensures that no undefined behaviour occurs in the FFI calls to pulseaudio. It also introduces proper error handling in the player thread: When the player fails to open or write audio, instead of panicking, it tries to reconnect to the sink every 5 seconds until it succeeds or playback is stopped.
With this patchset, librespot has been very reliable when running with pulseaudio and setting PULSE_SERVER to a remote host, even when the remote host goes down and comes up again.