Fix: exclude text processors from Stream.getProcessors when text is disabled
Created by: 03k64
This fixes a bug observed with low-latency streams containing one or more text representations. The bug prevented the liveCatchUpPlaybackRate
from being correctly applied following a buffer stall, leading to unconstrained drift from the user-specified target latency.
The bug manifested as follows:
- a buffer stall event occurs, the
playbackStalled
field onStreamController
is set totrue
-
StreamController.startPlaybackCatchUp
is called, it usesStreamController.getBufferLevel
to obtain the lowest current audio, video text or fragmented text buffer level - in streams with a text or fragmented text representation, the recent change to disable text by default resulted in an empty buffer being maintained for that representation unless text had been explicitly enabled for the player
- the empty buffer prevents
StreamController.startPlaybackCatchUp
from resetting theplaybackStalled
field ofStreamController
tofalse
, further, it assumes a buffer stall is ongoing, and resets thenewRate
to1.0
, preventing latency from being reduced
This change then checks whether text has been enabled and only adds the stream processors for textual representations to those returned by the Stream.getProcessors
if it is. I have added some tests to document/verify the new intended behaviour. I have also included a smaller change, that modifies a function-level variable name to provide clarity due to a class-level variable with the same name.
This is my first PR, however I am submitting as part of my work at the BBC, who have previously signed up to the dash.js feedback agreement.