hls.js 1.5.9-0.canary.10267 → 1.5.9-0.canary.10269
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hls.js +85 -73
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +11 -7
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +11 -7
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +50 -60
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/base-stream-controller.ts +16 -5
- package/src/controller/timeline-controller.ts +9 -12
- package/src/utils/cea-608-parser.ts +45 -53
package/dist/hls.mjs
CHANGED
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
|
|
512
512
|
// Some browsers don't allow to use bind on console object anyway
|
513
513
|
// fallback to default if needed
|
514
514
|
try {
|
515
|
-
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.9-0.canary.
|
515
|
+
newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.9-0.canary.10269"}`);
|
516
516
|
} catch (e) {
|
517
517
|
/* log fn threw an exception. All logger methods are no-ops. */
|
518
518
|
return createLogger();
|
@@ -9688,11 +9688,14 @@ class BaseStreamController extends TaskLoop {
|
|
9688
9688
|
} = this;
|
9689
9689
|
const fragState = fragmentTracker.getState(frag);
|
9690
9690
|
if (fragState === FragmentState.APPENDING) {
|
9691
|
-
// Lower the buffer
|
9691
|
+
// Lower the max buffer length and try again
|
9692
9692
|
const playlistType = frag.type;
|
9693
9693
|
const bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
|
9694
9694
|
const minForwardBufferLength = Math.max(frag.duration, bufferedInfo ? bufferedInfo.len : this.config.maxBufferLength);
|
9695
|
-
|
9695
|
+
// If backtracking, always remove from the tracker without reducing max buffer length
|
9696
|
+
const backtrackFragment = this.backtrackFragment;
|
9697
|
+
const backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
|
9698
|
+
if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
|
9696
9699
|
fragmentTracker.removeFragment(frag);
|
9697
9700
|
}
|
9698
9701
|
} else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
|
@@ -10196,10 +10199,11 @@ class BaseStreamController extends TaskLoop {
|
|
10196
10199
|
reduceMaxBufferLength(threshold) {
|
10197
10200
|
const config = this.config;
|
10198
10201
|
const minLength = threshold || config.maxBufferLength;
|
10199
|
-
|
10202
|
+
const reducedLength = config.maxMaxBufferLength / 2;
|
10203
|
+
if (reducedLength >= minLength) {
|
10200
10204
|
// reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
|
10201
|
-
config.maxMaxBufferLength
|
10202
|
-
this.warn(`Reduce max buffer length to ${
|
10205
|
+
config.maxMaxBufferLength = reducedLength;
|
10206
|
+
this.warn(`Reduce max buffer length to ${reducedLength}s`);
|
10203
10207
|
return true;
|
10204
10208
|
}
|
10205
10209
|
return false;
|
@@ -20203,13 +20207,7 @@ const specialCea608CharsCodes = {
|
|
20203
20207
|
/**
|
20204
20208
|
* Utils
|
20205
20209
|
*/
|
20206
|
-
const getCharForByte =
|
20207
|
-
let charCode = byte;
|
20208
|
-
if (specialCea608CharsCodes.hasOwnProperty(byte)) {
|
20209
|
-
charCode = specialCea608CharsCodes[byte];
|
20210
|
-
}
|
20211
|
-
return String.fromCharCode(charCode);
|
20212
|
-
};
|
20210
|
+
const getCharForByte = byte => String.fromCharCode(specialCea608CharsCodes[byte] || byte);
|
20213
20211
|
const NR_ROWS = 15;
|
20214
20212
|
const NR_COLS = 100;
|
20215
20213
|
// Tables to look up row from PAC data
|
@@ -20897,28 +20895,39 @@ class Cea608Parser {
|
|
20897
20895
|
* Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.
|
20898
20896
|
*/
|
20899
20897
|
addData(time, byteList) {
|
20900
|
-
let cmdFound;
|
20901
|
-
let a;
|
20902
|
-
let b;
|
20903
|
-
let charsFound = false;
|
20904
20898
|
this.logger.time = time;
|
20905
20899
|
for (let i = 0; i < byteList.length; i += 2) {
|
20906
|
-
a = byteList[i] & 0x7f;
|
20907
|
-
b = byteList[i + 1] & 0x7f;
|
20900
|
+
const a = byteList[i] & 0x7f;
|
20901
|
+
const b = byteList[i + 1] & 0x7f;
|
20902
|
+
let cmdFound = false;
|
20903
|
+
let charsFound = null;
|
20908
20904
|
if (a === 0 && b === 0) {
|
20909
20905
|
continue;
|
20910
20906
|
} else {
|
20911
|
-
this.logger.log(3, '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');
|
20912
|
-
}
|
20913
|
-
|
20914
|
-
|
20915
|
-
|
20916
|
-
|
20917
|
-
|
20918
|
-
|
20919
|
-
|
20920
|
-
|
20921
|
-
|
20907
|
+
this.logger.log(3, () => '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');
|
20908
|
+
}
|
20909
|
+
const cmdHistory = this.cmdHistory;
|
20910
|
+
const isControlCode = a >= 0x10 && a <= 0x1f;
|
20911
|
+
if (isControlCode) {
|
20912
|
+
// Skip redundant control codes
|
20913
|
+
if (hasCmdRepeated(a, b, cmdHistory)) {
|
20914
|
+
setLastCmd(null, null, cmdHistory);
|
20915
|
+
this.logger.log(3, () => 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');
|
20916
|
+
continue;
|
20917
|
+
}
|
20918
|
+
setLastCmd(a, b, this.cmdHistory);
|
20919
|
+
cmdFound = this.parseCmd(a, b);
|
20920
|
+
if (!cmdFound) {
|
20921
|
+
cmdFound = this.parseMidrow(a, b);
|
20922
|
+
}
|
20923
|
+
if (!cmdFound) {
|
20924
|
+
cmdFound = this.parsePAC(a, b);
|
20925
|
+
}
|
20926
|
+
if (!cmdFound) {
|
20927
|
+
cmdFound = this.parseBackgroundAttributes(a, b);
|
20928
|
+
}
|
20929
|
+
} else {
|
20930
|
+
setLastCmd(null, null, cmdHistory);
|
20922
20931
|
}
|
20923
20932
|
if (!cmdFound) {
|
20924
20933
|
charsFound = this.parseChars(a, b);
|
@@ -20933,7 +20942,7 @@ class Cea608Parser {
|
|
20933
20942
|
}
|
20934
20943
|
}
|
20935
20944
|
if (!cmdFound && !charsFound) {
|
20936
|
-
this.logger.log(2, "Couldn't parse cleaned data " + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));
|
20945
|
+
this.logger.log(2, () => "Couldn't parse cleaned data " + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));
|
20937
20946
|
}
|
20938
20947
|
}
|
20939
20948
|
}
|
@@ -20943,19 +20952,11 @@ class Cea608Parser {
|
|
20943
20952
|
* @returns True if a command was found
|
20944
20953
|
*/
|
20945
20954
|
parseCmd(a, b) {
|
20946
|
-
const {
|
20947
|
-
cmdHistory
|
20948
|
-
} = this;
|
20949
20955
|
const cond1 = (a === 0x14 || a === 0x1c || a === 0x15 || a === 0x1d) && b >= 0x20 && b <= 0x2f;
|
20950
20956
|
const cond2 = (a === 0x17 || a === 0x1f) && b >= 0x21 && b <= 0x23;
|
20951
20957
|
if (!(cond1 || cond2)) {
|
20952
20958
|
return false;
|
20953
20959
|
}
|
20954
|
-
if (hasCmdRepeated(a, b, cmdHistory)) {
|
20955
|
-
setLastCmd(null, null, cmdHistory);
|
20956
|
-
this.logger.log(3, 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');
|
20957
|
-
return true;
|
20958
|
-
}
|
20959
20960
|
const chNr = a === 0x14 || a === 0x15 || a === 0x17 ? 1 : 2;
|
20960
20961
|
const channel = this.channels[chNr];
|
20961
20962
|
if (a === 0x14 || a === 0x15 || a === 0x1c || a === 0x1d) {
|
@@ -20996,7 +20997,6 @@ class Cea608Parser {
|
|
20996
20997
|
// a == 0x17 || a == 0x1F
|
20997
20998
|
channel.ccTO(b - 0x20);
|
20998
20999
|
}
|
20999
|
-
setLastCmd(a, b, cmdHistory);
|
21000
21000
|
this.currentChannel = chNr;
|
21001
21001
|
return true;
|
21002
21002
|
}
|
@@ -21021,7 +21021,7 @@ class Cea608Parser {
|
|
21021
21021
|
return false;
|
21022
21022
|
}
|
21023
21023
|
channel.ccMIDROW(b);
|
21024
|
-
this.logger.log(3, 'MIDROW (' + numArrayToHexArray([a, b]) + ')');
|
21024
|
+
this.logger.log(3, () => 'MIDROW (' + numArrayToHexArray([a, b]) + ')');
|
21025
21025
|
return true;
|
21026
21026
|
}
|
21027
21027
|
return false;
|
@@ -21033,16 +21033,11 @@ class Cea608Parser {
|
|
21033
21033
|
*/
|
21034
21034
|
parsePAC(a, b) {
|
21035
21035
|
let row;
|
21036
|
-
const cmdHistory = this.cmdHistory;
|
21037
21036
|
const case1 = (a >= 0x11 && a <= 0x17 || a >= 0x19 && a <= 0x1f) && b >= 0x40 && b <= 0x7f;
|
21038
21037
|
const case2 = (a === 0x10 || a === 0x18) && b >= 0x40 && b <= 0x5f;
|
21039
21038
|
if (!(case1 || case2)) {
|
21040
21039
|
return false;
|
21041
21040
|
}
|
21042
|
-
if (hasCmdRepeated(a, b, cmdHistory)) {
|
21043
|
-
setLastCmd(null, null, cmdHistory);
|
21044
|
-
return true; // Repeated commands are dropped (once)
|
21045
|
-
}
|
21046
21041
|
const chNr = a <= 0x17 ? 1 : 2;
|
21047
21042
|
if (b >= 0x40 && b <= 0x5f) {
|
21048
21043
|
row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];
|
@@ -21055,7 +21050,6 @@ class Cea608Parser {
|
|
21055
21050
|
return false;
|
21056
21051
|
}
|
21057
21052
|
channel.setPAC(this.interpretPAC(row, b));
|
21058
|
-
setLastCmd(a, b, cmdHistory);
|
21059
21053
|
this.currentChannel = chNr;
|
21060
21054
|
return true;
|
21061
21055
|
}
|
@@ -21115,15 +21109,13 @@ class Cea608Parser {
|
|
21115
21109
|
} else {
|
21116
21110
|
oneCode = b + 0x90;
|
21117
21111
|
}
|
21118
|
-
this.logger.log(2, "Special char '" + getCharForByte(oneCode) + "' in channel " + channelNr);
|
21112
|
+
this.logger.log(2, () => "Special char '" + getCharForByte(oneCode) + "' in channel " + channelNr);
|
21119
21113
|
charCodes = [oneCode];
|
21120
21114
|
} else if (a >= 0x20 && a <= 0x7f) {
|
21121
21115
|
charCodes = b === 0 ? [a] : [a, b];
|
21122
21116
|
}
|
21123
21117
|
if (charCodes) {
|
21124
|
-
|
21125
|
-
this.logger.log(3, 'Char codes = ' + hexCodes.join(','));
|
21126
|
-
setLastCmd(a, b, this.cmdHistory);
|
21118
|
+
this.logger.log(3, () => 'Char codes = ' + numArrayToHexArray(charCodes).join(','));
|
21127
21119
|
}
|
21128
21120
|
return charCodes;
|
21129
21121
|
}
|
@@ -21157,7 +21149,6 @@ class Cea608Parser {
|
|
21157
21149
|
const chNr = a <= 0x17 ? 1 : 2;
|
21158
21150
|
const channel = this.channels[chNr];
|
21159
21151
|
channel.setBkgData(bkgData);
|
21160
|
-
setLastCmd(a, b, this.cmdHistory);
|
21161
21152
|
return true;
|
21162
21153
|
}
|
21163
21154
|
|
@@ -21171,7 +21162,7 @@ class Cea608Parser {
|
|
21171
21162
|
channel.reset();
|
21172
21163
|
}
|
21173
21164
|
}
|
21174
|
-
this.cmdHistory
|
21165
|
+
setLastCmd(null, null, this.cmdHistory);
|
21175
21166
|
}
|
21176
21167
|
|
21177
21168
|
/**
|
@@ -22644,17 +22635,16 @@ class TimelineController {
|
|
22644
22635
|
cea608Parser2,
|
22645
22636
|
lastSn
|
22646
22637
|
} = this;
|
22647
|
-
if (!cea608Parser1 || !cea608Parser2) {
|
22648
|
-
return;
|
22649
|
-
}
|
22650
22638
|
const {
|
22651
22639
|
cc,
|
22652
22640
|
sn
|
22653
22641
|
} = data.frag;
|
22654
22642
|
const partIndex = (_data$part$index = (_data$part = data.part) == null ? void 0 : _data$part.index) != null ? _data$part$index : -1;
|
22655
|
-
if (
|
22656
|
-
|
22657
|
-
|
22643
|
+
if (cea608Parser1 && cea608Parser2) {
|
22644
|
+
if (sn !== lastSn + 1 || sn === lastSn && partIndex !== this.lastPartIndex + 1 || cc !== this.lastCc) {
|
22645
|
+
cea608Parser1.reset();
|
22646
|
+
cea608Parser2.reset();
|
22647
|
+
}
|
22658
22648
|
}
|
22659
22649
|
this.lastCc = cc;
|
22660
22650
|
this.lastSn = sn;
|
@@ -29024,7 +29014,7 @@ class Hls {
|
|
29024
29014
|
* Get the video-dev/hls.js package version.
|
29025
29015
|
*/
|
29026
29016
|
static get version() {
|
29027
|
-
return "1.5.9-0.canary.
|
29017
|
+
return "1.5.9-0.canary.10269";
|
29028
29018
|
}
|
29029
29019
|
|
29030
29020
|
/**
|