dheijl / swyh-rs

Stream What You Hear written in rust, inspired by SWYH.
MIT License
370 stars 15 forks source link

Audio streaming on Linux not working | Connection immediately terminated #31

Closed FinalSh4re closed 3 years ago

FinalSh4re commented 3 years ago

Hi,

first of all thanks for your hard work. I can't get the audio casting on Linux (Manjaro 20.2.1) to work though. The renderer is found on the network, but the connection is terminated immediately. No audio is played either.

I attach the log, maybe you can see where this is going wrong. If you need further information, let me know.

Cheers!

Log file: log.txt

dheijl commented 3 years ago

Everything seems to work as expected for an AVTransport DLNA player, except for the streaming of the music. It's possible that it does not accept the "naked" PCM audio stream (audio/l16), perhaps it needs a WAV header, maybe the same problem as with Sonos speakers. I could make a test release that sends the stream in WAV format if you're interested.

FinalSh4re commented 3 years ago

Sure, if you think that will do the trick I would appreciate it.

dheijl commented 3 years ago

OK I'll look into the WAV format and will try to get that working here. If it works I'll make a beta release. Thanks!

dheijl commented 3 years ago

There's a new beta in releases with WMA file format support.

FinalSh4re commented 3 years ago

Thank you, I made a test run and checked a few different setting combinations. The connection is now stable and no longer drops, however i hear mostly static noise through the speakers.

dheijl commented 3 years ago

Yes, it's not OK yet. But I think I know where the static noise comes from.

dheijl commented 3 years ago

What combination of settings got you the stable connection?

FinalSh4re commented 3 years ago

The connection was stable as long as the new 'Use WMA/WAV Format'-Checkbox was toggled.

dheijl commented 3 years ago

OK thanks!

dheijl commented 3 years ago

In theory the WAV format is correct now (in the 1.3.5-beta) for "infinite" streaming, depending on how the renderer opens the stream.

FinalSh4re commented 3 years ago

It works like a charm. Thanks a lot!

Just fyi I seem to get the best result with the "use wma/wav format" + "disable chunked transfer encoding" boxes toggled. Without the latter checked the audio seems a bit unstable at times (noise and stuttering), nothing major but still noticeable. I tested it against the same source audio streamed from my iPhone and both streams sound the same to me. Hope this helps.

Cheers!

dheijl commented 3 years ago

Thanks for the feedback! Glad that it works for you, it does not work for me with a Volumio streamer because of the libsndfile problem, so I can not test it myself.

dheijl commented 3 years ago

As an aside: on Linux if you run swyh-rs as root (sudo) it will renice itself to a higher priority in an attempt to prevent stuttering. Or you can renice it yourself once it is running. On Windows it will always raise priority a bit.

FinalSh4re commented 3 years ago

Thanks for letting me know, you also mentioned this in the documentation. I'll try giving the process a higher priority should I encounter any performance issues. So far turning off the chunked transfer encoding has been enough to get stable output. However, I haven't really tested streaming while running any resource intensive processes in parallel so this option might come in handy in the future.