dash.js - why getting BUFFER_EMPTY events?

1.5k Views Asked by At

No matter how I try to configure live stream in dash.js player, occasionally I get BUFFER_EMPTY event ('bufferStalled'), then playback pauses and is rebuffering.

It's somehow related to "buffer level", but I'm not able to configure the buffer level so that it doesn't underflow. From logs/events I see that "buffer level" bounces around 10sec, but sometimes it drops to 0.5, below which it fires the bufferStalled event and breaks playback. I play video content from LAN, so network conditions are OK.

Any idea how to configure this to have stable video streaming?

1

There are 1 best solutions below

0
Mick On

The issue might be with the server streams also and the available bit rates - it would need some testing.

When a player sees low buffering it will generally switch to a lower bit rate to give a better chance of getting the stream across the network (in simple terms - see below for more detailed info). It may be that one of the lower streams actually has an issue on your packager or streaming sever. Obviously, its hard to say without testing.

Its also worth thinking about the segment lengths - shorter segments make it easier to switch quickly as a general rule.

And. even though it is a LAN, the LAN traffic or even other activity on the host machine could still be a factor.

If you just want to see how the dash.js buffering works there is a good guide here: https://github.com/Dash-Industry-Forum/dash.js/wiki/ABR-Logic

and an overview diagram here: https://github.com/Dash-Industry-Forum/dash.js/wiki/Buffer-and-Scheduling-Logic

Dash.js changed the approach in the middle of last year to use dynamic switching between the two main buffering rules that were in place - it is described in the GitHub changes (https://github.com/Dash-Industry-Forum/dash.js/pull/2083) but a quick summary from there of two two rules which are both used now is:

  • ThroughputRule is desirable in transient conditions such as startup and seeking.
  • BolaRule is desirable in stable conditions with sufficient buffer.

A new stream starts on ThroughputRule and then switches to BolaRule when the buffer level reaches a threshold, switching back to ThroughputRule when the buffer level drops below a (lower-than-the-first) threshold and so on.

Note that while the automatic rule switching gets the best of both rules, both ThroughputRule and BolaRule can work well without the other.