Chromecast and gapless playback not always working

Let me explain the situation and where the issue most likely resides. There is a lot of guessing about updates and gapless support, so let me clarify with certainty:

We always have a gapless stream to the Chromecast audio engine. The audio engine of the Chromecast does not know about song boundaries when we play to it. Many other products will play a stream, and then terminate the connection to the audio engine, and then reconnect to it to play another stream. We do not do that because the Roon Core delivers a constant stream of audio packets, and not “files” or “URLs” or anything else that is broken up at the track boundary. Metadata updates are handled out of band, and have nothing to do with the audio. There is some complexity with internet radio streams and with sample rate switches, but that’s not super relevant here.

So what’s going on? Why would there be gaps, especially at track boundaries?

Well, the way the engine works, is that there is a buffer of audio data between the audio packet processor and Chromecast audio engine. That way, if network traffic hiccups or is in some way slowed, that buffer can fill the “gap”. For everything but internet radio, the buffer can be filled faster than real-time from the source, so this buffer stays full. Even after a small hiccup, where the buffer may drain a bit, it will fill back up quickly due to this faster-than-real-time buffering that occurs from playing files or streaming content.

If that buffer empties because there is such a large network hiccup, there will be no audio data to play, so we play silence. Some devices will just loop the buffer so you will hear the buffer over and over (think about when CD players get “stuck”, same idea). We don’t loop, we just play silence, and after a while, we deem the connection as broken and stop playback completely.

In one of the Roon builds (I forget which build number it was. It was the one that introduced sleep timers.), for various reasons, we had to make this buffer smaller. A smaller buffer, for less-than-perfect networks, means that less network trouble is required to empty the buffer. This caused many people to have Chromecast skips with less great networks. However, there is one time at which the buffer will usually drain a bit: the transition between tracks. There is just more work to do here, so there will always be a small delay in those first audio packets. If that buffer drains, you WILL hear a gap. If the buffer does not fully drain, you will hear no gap. We made a “fix” for this by increasing the buffer size every so slightly (but we can’t take it back up to the previous levels because that caused other issues), and by changing the initial buffering strategy for a new track: It more rapidly tries to make up for the drainage when a new song starts and it does it earlier. You can see some people have already figured it out.

Most people are having gapless playback on Chromecast just fine. Those using WiFi instead of ethernet will always have more trouble here, but WiFi does not mean guaranteed failure. For example, I personally have many Chromecast zones, of which 1 is WiFi, the rest are ethernet. I don’t have gaps or any instability in any of them.

At this point, we feel like we do not have a systemic problem. The rate of reported failures (from our analytics, not from user complaints), is at the % we would expect for network issues. Previously, the rate was higher than we would have expected from just network issues, which is why we made a shift in strategy.

This has nothing to do with any recent updates, as we haven’t touched anything related to the audio, and I doubt we’ll be making any changes in this system any time soon.

So, looking at the other complaints, I’m going to ask everyone having issues to try to eliminate network variables. Try ethernet if possible (I realize there are some Chromecast devices that only have WiFi). If you must WiFi, try 5ghz vs 2.4ghz.

To achieve gapless playback, you must have a reliable real-time capable network. What might work for many others systems may not be enough. Roon has higher demands on your network because it tries to achieve more. Most Chromecast integrations are not gapless, and it’s because it’s not an easy thing to get stable.

6 Likes