Skip to content
Kevin Spiteri edited this page Aug 2, 2017 · 19 revisions

The ABR Rules Collection (see ABRRulesCollection.js) has a list of rules which are queried before every new segment download. Each rule returns a maximum index, and the final decision is the minimum of each rule's return.

Primary Rules

The main rule driving ABR is either ThroughputRule or BolaRule. A player instance can be set to choose either of the two rules using the MediaPlayer.enableBufferOccupancyABR(value) method before loading the stream, where value=true enables BolaRule (disabling ThroughputRule) and value=false disables BolaRule (enabing ThroughputRule). If MediaPlayer.enableBufferOccupancyABR() is not called, ThroughputRule is enabled and BolaRule is disabled.

ThroughputRule uses the recent throughput history to predict the future throughput. Once it has a throughput estimate (see ThroughputHistory.js), ThroughputRule scales it down by a 90% safety factor and chooses the highest bitrate supported by the safe throughput. If ThroughputRule chooses the top bitrate and the buffer level rises above some rich buffer threshold (see MediaPlayer.setRichBufferThreshold(value)) then it will not choose a lower bitrate until the buffer level drops below the rich buffer threshold, even if the throughput drops.

BolaRule uses the buffer level to determine the bitrate: it prefers lower bitrates when the buffer level is lower and higher bitrates when the buffer level is higher. To avoid oscillations, BolaRule does not switch up to a bitrate if the throughput estimate (see ThroughputHistory.js) does not support the new higher bitrate. BolaRule keeps track of why the buffer level drops, maintaining a higher bitrate when the buffer level drops for reasons unrelated to network bandwidth limitations, e.g., when the buffer level is limited because of segment availability in live streaming.

Coming Soon: The PR #2083 obsoletes the MediaPlayer.enableBufferOccupancyABR() method and instead switches dynamically between the two rules, getting the best of both. It also obsoletes MediaPlayer.setRichBufferThreshold() because BolaRule is selected for high-buffer cases. See BOLA Status for more details.

Secondary Rules

While the active primary rule is the main determining factor, there is a number of secondary rules which handle some special cases.

InsufficientBufferRule is a safety net to avoid rebuffering. When the buffer level is low, InsufficientBufferRule limits the bitrate to a conservative throughput estimate. If rebuffering does occur, InsufficientBufferRule forces the lowest bitrate to speed up recovery.

SwitchHistoryRule avoids rapid bitrate oscillations. If any of the other ABR rules switch down from some bitrate, then SwitchHistoryRule disallows that bitrate and any higher bitrate for eight segments.

DroppedFramesRule avoids bitrates that cannot render properly due to CPU limitations. When the video element drops more than 15% of the frames for some bitrate, DroppedFramesRule disallows that bitrate and any higher bitrate.

Progress Monitoring Rule

The above rules are used before a new segment download starts. If the bandwidth drops excessively during the course of a high-bitrate download, it increases the risk of rebuffering.

AbandonRequestRule monitors the download progress during a segment download. If there is a rebuffering risk, it abandons the download and switches to a lower, safer bitrate.

Visual overview:

The following are simplified diagrams outlining ABR rules management.

zoom/edit

zoom/edit

Clone this wiki locally