plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Feature request: RTP backend #211

Open awiouy opened 7 years ago

awiouy commented 7 years ago

I currently pipe librespot audio to ffmpeg to stream it to Kodi as RTP. This implies the following path: vorbis to s16le to pcm-alaw to RTP. It would therefore be advantageous to add an RTP backend to librespot, which is likely to shorten the path to: vorbis to RTP. I would gladly do this myself, but I have no experience at all with Rust. I hope that someone here will pick up the idea, and give it a try. Thank you in advance.

awiouy commented 7 years ago

@plietar I managed to configure pulseaudio to create an RTP stream, using these commands: pactl load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 pactl load-module module-rtp-send source=rtp.monitor destination_ip=127.0.0.1 port=6666 ./librespot -c . --disable-audio-cache -n test --backend pulseaudio On LibreELEC, pulseaudio seems to be more responsive than ffmpeg. The pulseaudio backend could therefore be adapted to create a RTP stream. @shanemeagher do you think you can do this?

awiouy commented 7 years ago

I gather that something like #215 is all it takes to stream RTP via pulseaudio, see here: https://github.com/awiouy/LibreELEC.tv/blob/7a6a7a9b87e87b2749725310f3e689dfaa9335b1/packages/addons/service/librespot/source/bin/librespot.start#L102-L113