In a past and well appreciated TechNote, I explained a dynamic buffering technique which is able to take advantage of all the available bandwidth and, at the same time, is able to reduce, to the minimun, the pre-buffering time.
Recently I have improved the technique with a rate control code. This is the principle:
Use the prebuffering as rate control
A main advantage of the Dynamic buffering is the strong reduction of prebuffering time. This is obviously a great feature by itself, but we can find addictional value in it. We can use the prebuffering phase to measure the available bandwidth between client and server and therefore change accordingly the effective buffering depth or, if necessary, change the stream rate (between prerecorded ones).
The bandwidth measurement is indeed very simple. If we have set a prebuffer time of BT seconds, we can monitor the BufferLenght property measuring the time needed to fill the buffer to the i.e 80%. Let’s call this time T80.
We calculate an available/required bandwidth ratio: R=(BT*0.8)/T80
If R>1, the available bandwidth is higher than the required. i.e: 1.2 means +20%.
If R<1, the available bandwidth is lower than the required. i.e: 0.7 means -30%.
Depending by the R ratio, we can change the preloading behaviour before the preload ends (this is why we measure the bandwidth over the 80% of buffer filling).
If R is consistently higher than 1, the behaviour remains unchanged and the prebuffering time remains very short.
If R is only a little higher than 1, it’s better to enlarge the prebuffer depth. The prebuffering time becames longer but the playback more solid.
If R is lower than 1, we need to change the Stream with a scaled one. In this case, we have the great advantage of a short total buffering time, because, thanks to the Dynamic buffering, both the first (used to measure and then dropped) and the second (scaled stream) prebuffering times are inherently short.
A note to conclude:
I have created this Dynamic buffering scheme remembering of a key feature of Windows Media Player 9: Microsoft calls it “Fast-Streaming”. Now, it is available also for our beloved FMS2.
FIG 1 . Standard Buffering: Bandwidth fluctuations vs Buffer time
FIG 2 . Dynamic Buffering: Bandwidth fluctuations vs Buffer time