summaryrefslogtreecommitdiff
path: root/soundbox/pipewire.go
AgeCommit message (Collapse)Author
2024-12-15pipewire: Assert OS is GNU / Linuxxegineering
PipeWire is a Linux-specific sound system. This commit adds a proper error if the operating is not matching.
2024-12-15pipewire: Make sure only one instance is runningxegineering
The init / deinit of the PipeWire C library is not well handled for multiple instances. Furthermore the PipeWire audio streaming relies on a channel which is a global variable. Both issues have to be fixed before multiple PipeWire capture instances are allowed.
2024-12-15pipewire: Fix silence droppingxegineering
It used to drop silence per channel, not silence per sample. In the unlikely case of perfect silence on one channel and sound on the other this would switch effectively the channels.
2024-12-15pipewire: Implement capture tear-downxegineering
This closes the PipeWire process properly to not leak memory and remove the PipeWire capture node of soundbox as soon as the context passed to StreamPipewireContext() is closed.
2024-12-08Apply go fmtxegineering
2024-12-08pipewire: Fix huge latency by dropping silencexegineering
The current architecture uses the following processing: - capture raw audio from PipeWire as unsigned 16 bit integers - convert with a `ffmpeg` process to OGG / FLAC - stream the `ffmpeg` output to multiple soundboxes via TCP Only the first part is different for URL sources. Since using PipeWire significant latency (up to 15 seconds) were measured. It turned out that this happens exactly when zero bytes (silence) are fed into the `ffmpeg` process. This commit avoids this by dropping those empty samples. It has to be made sure that only samples are dropped where both channels are zero. Otherwise audible noise is the result.
2024-12-08pipewire: Add experimental PipeWire supportxegineering
This implements a PipeWire capture device which can be used as an input source instead of the already available URL input. Known issues with the current PipeWire support are: - user has to connect the monitor of the default audio sink to the capture device manually - correct shutdown has to be tested - multiple instances do not work - medium code quality requires refactoring Since this is nevertheless usable and possible unknown bugs should be figured out in practise soon this implementation is already added. Bugfixes and refactoring might follow.