-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play a couple seconds of silence before going idle? #205
Comments
@badaix any thoughts on this? I'm interested in seeing if you think this is a good idea. |
@airdrummingfool sorry for the seven month delay :) |
I like it. Maybe it could be another base parameter "silence_ms" (or preferably a better name, maybe "dryout_ms"), encoded in PcmStream's URI, e.g. if (uri_.query.find("silence_ms") != uri_.query.end())
silenceMs_ = cpt::stoul(uri_.query["silence_ms"]); with a default value of 2000, if not set |
can this be closed, now that the PR is merged? |
Yep, thanks for the ping. |
I'm posting this as an issue before I PR because I'm not sure if this is something snapcast should concern itself with.
I use snapcast to listen to Spotify via librespot. In between songs, librespot stops outputting while it loads the next song (see plietar/librespot#18), which means snapserver goes idle for a time (for me, less than 1 second). This idle time is enough to cause both my macOS and Linux (RPi) clients to lose their sync. On Linux, audio returns pretty much instantly, and full sync (no
sleep
log statements) is re-established within 3 seconds. On macOS, audio normally returns almost instantly, but it takes some time (anywhere from 3-30 seconds) for the smallsleep
adjustments to settle down and gain full sync.In practice, 98% of the time I cannot tell that the clients desync between songs. However, every once in a while, one of my macOS clients will go wonky while recovering, and the first ~20-30 seconds of the song is unintelligible, if not unbearable.
My thought is to have snapserver send up to 2(?) seconds of silence when input dries up, before going idle and allowing the clients to desync. In my testing, this eliminates the desync issue on both macOS and Linux during song changes and when skipping between songs.
Right now my implementation only affects inputs read via
processStream.cpp
and derivatives (i.e. not when reading from a fifo), but it can easily be copied over topipeStream.cpp
(there might be a better place to implement it). It would be easy to hide behind a compiler flag or a command-line argument if necessary.Again, I don't even know if this is something that should be implemented in snapcast (vs addressing it in individual sources, such as the librespot issue referenced above). If you do think this is something that would improve snapcast, I'll create a PR so we can go over implementation details.
The text was updated successfully, but these errors were encountered: