Skip to content

Commit 0b8d091

Browse files
committed
Fix: exclude text processors when text is disabled
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: 1. a buffer stall event occurs, the 'playbackStalled' field on StreamController is set to 'true' 2. 'StreamController.startPlaybackCatchUp' is called, it uses 'StreamController.getBufferLevel' to obtain the lowest current audio, video text or fragmented text buffer level 3. 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 4. the empty buffer prevents 'StreamController.startPlaybackCatchUp' from resetting the 'playbackStalled' field of 'StreamController' to 'false', further, it assumes a buffer stall is ongoing, and resets the 'newRate' to '1.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. Tested on Firefox 78.02 & Chrome 84.0.414.79 on Ubuntu 20.04.
1 parent d1ccff3 commit 0b8d091

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/streaming/Stream.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ function Stream(config) {
714714
}
715715

716716
function getProcessors() {
717+
const isTextEnabled = textController.isTextEnabled();
718+
717719
let arr = [];
718720

719721
let type,
@@ -723,7 +725,9 @@ function Stream(config) {
723725
streamProcessor = streamProcessors[i];
724726
type = streamProcessor.getType();
725727

726-
if (type === Constants.AUDIO || type === Constants.VIDEO || type === Constants.FRAGMENTED_TEXT || type === Constants.TEXT) {
728+
if (type === Constants.AUDIO || type === Constants.VIDEO) {
729+
arr.push(streamProcessor);
730+
} else if ((type === Constants.FRAGMENTED_TEXT || type == Constants.TEXT) && isTextEnabled) {
727731
arr.push(streamProcessor);
728732
}
729733
}

0 commit comments

Comments
 (0)