0
Answered

Buffering Questions

DonpK 4 years ago • updated by Jona (Lead Developer) 4 years ago 5
I have a couple of questions about buffering.

When listening to a live radio stream, if Pre-buffering is set to, say, 10 seconds and a station is selected, I would expect a delay of at least 10 seconds before hearing audio. In fact, I hear audio within a second or two. Why is this?

If the "Buffer length" is set to, say, 40 seconds, when a live stream is selected I would expect a delay of at least 40 seconds for the buffer to be filled before I hear the first audio. As mentioned in my first question, I hear audio within a couple seconds of selecting the station. Why is this?

I read in an earlier post elsewhere on the forum that FFmpeg stream engine, which appears to be the default, does not support buffering. However, that was 10 months ago. Have things changed since then?

Answer

Answer
Answered
Here is a little background about buffering settings I recommend reading.
http://support.xiialive.com/topic/283567-understan...

Something interesting to know is that some stations send a burst of audio data when initially connecting. The audio burst can range up to 60 seconds or higher. This means that a 10 second pre-buffer setting will get filled very quickly. The buffer setting is not used for the initial connection as you will see on the provided link above.
Answer
Answered
Here is a little background about buffering settings I recommend reading.
http://support.xiialive.com/topic/283567-understan...

Something interesting to know is that some stations send a burst of audio data when initially connecting. The audio burst can range up to 60 seconds or higher. This means that a 10 second pre-buffer setting will get filled very quickly. The buffer setting is not used for the initial connection as you will see on the provided link above.
Thanks for your answer. I had already read the article you linked to as well  as several others including this article by Microsoft. In the section on "Fast Start" they talk about the audio burst you mention. They also say that the station's "server must add broadcast delay to the stream and maintain a buffer"  for the burst technique to work. So if the station has a 30 second buffer of their live broadcast, they can burst-send that 30 seconds in a few seconds to the listener's receiver, if I understand it correctly. In this example, there would be a delay of a few seconds (the length of the burst) before the listener starts to hear audio. However, wouldn't the listener's audio be 30 seconds behind the live broadcast? I checked a local station and the stream is about three seconds behind. I have my Pre-buffer set to 10 seconds and Buffer length to 40 seconds.

I can understand how the longer Xiialive buffer times could work with pre-recorded streams, but in the a live stream unless the broadcaster's buffer is 40 seconds, the Xiialive player would have to pre-buffer for 40 seconds. Am I missing something?

Don
Thanks for sharing that link. Interesting post! :)

There could be a lot of factors why the live local station is few seconds behind. Maybe the station is being repeated from another station causing further delays or they maybe have internally some broadcasting delays. I'm not 100% sure how they handle internally their live on the air station.

About the 40 seconds buffer, I think you are confusing pre-buffer and buffer settings. I think the naming could be a little difficult to understand. Essentially, the pre-buffer is the initial amount of audio data that is required to gather before playback can start. In the other hand the buffer length setting of 40 sec will only be triggered when the player starves of audio data. This could happen if you go through a slow network connection area. Data doesn't download fast enough causing the player to go into a "buffering" state. Once it enters a buffering state it must gather 40 sec of audio data before it can resume playback. So pre-buffer setting is only used for the initial connection while buffer setting is used when the player goes into a buffering state after having played something initially.
Perhaps I am confused. See if this is correct. If I listen to a live stream that typically has interruptions of no more that 10 seconds, I should set the Pre-buffer to at least 10 seconds. So when a 10 second interruption occurs, the information in the pre-buffer is played out. At this point, there is no more information left in the pre-buffer. Is that where the buffer setting comes in and how should it be set up?

Sorry for the questions.
 Don
Yes, you are correct. After the 10 seconds are played and no audio data has been downloaded a buffer state will be triggered and that is where the buffer setting comes to play.

How to set it up... Well, I recommend setting the Pre-buffer low around 3-5 seconds to get playback to start almost immediately. The station might send a huge burst of audio data all while the player is playing. The burst might add an extra 10-30 seconds of buffer audio data.... So for the buffer setting, I would recommend it a little bit higher than pre-buffer. Maybe 10-15 seconds. I really don't see a benefit of making it larger and having to wait in silence for audio to buffer. So yeah larger buffer size will help avoid silence during dead spots but regardless you will have silence waiting for it to be filled... So there is really no real benefits in setting high values for pre-buffer and buffer settings.