mattebox 0.14.0 → 0.15.0
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/README.md +29 -21
- package/dist/cdn/mattebox.dash-drm.min.js +3 -3
- package/dist/cdn/mattebox.dash-ll.min.js +3 -0
- package/dist/cdn/mattebox.dash.min.js +3 -3
- package/dist/cdn/mattebox.dual-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ll.min.js +3 -0
- package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.dual-ts.min.js +3 -3
- package/dist/cdn/mattebox.dual.min.js +3 -3
- package/dist/cdn/mattebox.hls-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ll.min.js +3 -0
- package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
- package/dist/cdn/mattebox.hls-ts.min.js +3 -3
- package/dist/cdn/mattebox.hls.min.js +3 -3
- package/dist/cdn/mattebox.kernel.min.js +1 -1
- package/dist/cdn/mattebox.min.js +5 -5
- package/dist/containers/fmp4/writer.d.ts +7 -1
- package/dist/containers/fmp4/writer.d.ts.map +1 -1
- package/dist/containers/fmp4/writer.js +2 -1
- package/dist/containers/fmp4/writer.js.map +1 -1
- package/dist/containers/mp4-box/index.d.ts +8 -0
- package/dist/containers/mp4-box/index.d.ts.map +1 -1
- package/dist/containers/mp4-box/index.js +27 -0
- package/dist/containers/mp4-box/index.js.map +1 -1
- package/dist/containers/ts-transmux/demux.d.ts +2 -0
- package/dist/containers/ts-transmux/demux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/demux.js +3 -1
- package/dist/containers/ts-transmux/demux.js.map +1 -1
- package/dist/containers/ts-transmux/h265.d.ts +51 -0
- package/dist/containers/ts-transmux/h265.d.ts.map +1 -0
- package/dist/containers/ts-transmux/h265.js +182 -0
- package/dist/containers/ts-transmux/h265.js.map +1 -0
- package/dist/containers/ts-transmux/transmux.d.ts +3 -2
- package/dist/containers/ts-transmux/transmux.d.ts.map +1 -1
- package/dist/containers/ts-transmux/transmux.js +35 -11
- package/dist/containers/ts-transmux/transmux.js.map +1 -1
- package/dist/eme/index.d.ts +1 -10
- package/dist/eme/index.d.ts.map +1 -1
- package/dist/eme/index.js +4 -2
- package/dist/eme/index.js.map +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/asyncToGenerator.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/defineProperty.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectSpread2.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectWithoutProperties.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPrimitive.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/toPropertyKey.js +1 -1
- package/dist/es2015/_virtual/{_@oxc-project_runtime@0.152.0 → _@oxc-project_runtime@0.153.0}/helpers/esm/typeof.js +1 -1
- package/dist/es2015/containers/fmp4/writer.js +2 -1
- package/dist/es2015/containers/id3.js +1 -1
- package/dist/es2015/containers/mp4-box/index.js +24 -1
- package/dist/es2015/containers/scte35.js +1 -1
- package/dist/es2015/containers/ts-transmux/demux.js +3 -1
- package/dist/es2015/containers/ts-transmux/h264.js +1 -1
- package/dist/es2015/containers/ts-transmux/h265.js +175 -0
- package/dist/es2015/containers/ts-transmux/index.js +1 -1
- package/dist/es2015/containers/ts-transmux/runner.js +2 -2
- package/dist/es2015/containers/ts-transmux/transmux.js +39 -16
- package/dist/es2015/containers/webvtt.js +1 -1
- package/dist/es2015/containers/wvtt.js +1 -1
- package/dist/es2015/eme/index.js +7 -5
- package/dist/es2015/index.js +6 -2
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/context.js +7 -0
- package/dist/es2015/kernel/dry-run.js +1 -1
- package/dist/es2015/kernel/mse.js +1 -1
- package/dist/es2015/kernel/prepare.js +3 -3
- package/dist/es2015/kernel/reducer.js +90 -31
- package/dist/es2015/kernel/refresh.js +2 -2
- package/dist/es2015/kernel/rendition-select.js +2 -2
- package/dist/es2015/kernel/scheduler.js +31 -6
- package/dist/es2015/kernel/timeline.js +1 -1
- package/dist/es2015/kernel/trace.js +1 -1
- package/dist/es2015/kernel/transport.js +154 -22
- package/dist/es2015/presets/dash-ll/index.js +15 -0
- package/dist/es2015/presets/define.js +2 -2
- package/dist/es2015/presets/dual-ll/index.js +16 -0
- package/dist/es2015/presets/full/index.js +6 -4
- package/dist/es2015/presets/hls-ll/index.js +14 -0
- package/dist/es2015/presets/tiers.js +28 -3
- package/dist/es2015/protocols/dash-cmaf/index.js +13 -8
- package/dist/es2015/protocols/dash-cmaf/parse.js +129 -41
- package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
- package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
- package/dist/es2015/protocols/dash-live/index.js +75 -21
- package/dist/es2015/protocols/dash-ll/index.js +42 -0
- package/dist/es2015/protocols/hls-cmaf/index.js +5 -5
- package/dist/es2015/protocols/hls-cmaf/lexer.js +7 -1
- package/dist/es2015/protocols/hls-cmaf/parse.js +27 -12
- package/dist/es2015/protocols/hls-cmaf/unavailable.js +1 -1
- package/dist/es2015/protocols/hls-live/index.js +92 -18
- package/dist/es2015/protocols/hls-ll/index.js +30 -0
- package/dist/es2015/protocols/hls-ll/parse.js +240 -0
- package/dist/es2015/stages/abr/index.js +9 -2
- package/dist/es2015/stages/aes-128/index.js +1 -1
- package/dist/es2015/stages/chapters/index.js +2 -2
- package/dist/es2015/stages/chapters/parse.js +2 -2
- package/dist/es2015/stages/cmcd/index.js +7 -1
- package/dist/es2015/stages/codec-probe/index.js +1 -1
- package/dist/es2015/stages/content-steering/index.js +1 -1
- package/dist/es2015/stages/eme-core/index.js +193 -42
- package/dist/es2015/stages/eme-fairplay/index.js +1 -1
- package/dist/es2015/stages/hdr/index.js +1 -1
- package/dist/es2015/stages/live-catchup/index.js +221 -0
- package/dist/es2015/stages/qoe/index.js +1 -1
- package/dist/es2015/stages/recovery/index.js +2 -2
- package/dist/es2015/stages/rendition-names/index.js +1 -1
- package/dist/es2015/stages/text-cea608/decode.js +1 -1
- package/dist/es2015/stages/text-cea708/decode.js +2 -2
- package/dist/es2015/stages/text-cea708/index.js +1 -1
- package/dist/es2015/stages/text-ttml/images.js +60 -0
- package/dist/es2015/stages/text-ttml/index.js +22 -6
- package/dist/es2015/stages/text-ttml/parse.js +71 -5
- package/dist/es2015/stages/thumbnails/index.js +1 -1
- package/dist/es2015/stages/timed-metadata/index.js +1 -1
- package/dist/es2015/stages/trick-play/index.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/kernel/context.d.ts +4 -6
- package/dist/kernel/context.d.ts.map +1 -1
- package/dist/kernel/context.js +10 -0
- package/dist/kernel/context.js.map +1 -1
- package/dist/kernel/lifecycle.d.ts +2 -6
- package/dist/kernel/lifecycle.d.ts.map +1 -1
- package/dist/kernel/lifecycle.js.map +1 -1
- package/dist/kernel/prepare.d.ts +3 -0
- package/dist/kernel/prepare.d.ts.map +1 -1
- package/dist/kernel/prepare.js +2 -1
- package/dist/kernel/prepare.js.map +1 -1
- package/dist/kernel/reducer.d.ts.map +1 -1
- package/dist/kernel/reducer.js +95 -40
- package/dist/kernel/reducer.js.map +1 -1
- package/dist/kernel/refresh.d.ts.map +1 -1
- package/dist/kernel/refresh.js +2 -0
- package/dist/kernel/refresh.js.map +1 -1
- package/dist/kernel/scheduler.d.ts.map +1 -1
- package/dist/kernel/scheduler.js +40 -3
- package/dist/kernel/scheduler.js.map +1 -1
- package/dist/kernel/transport.d.ts +34 -5
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +148 -11
- package/dist/kernel/transport.js.map +1 -1
- package/dist/presets/dash-ll/index.d.ts +4 -0
- package/dist/presets/dash-ll/index.d.ts.map +1 -0
- package/dist/presets/dash-ll/index.js +10 -0
- package/dist/presets/dash-ll/index.js.map +1 -0
- package/dist/presets/dual-ll/index.d.ts +4 -0
- package/dist/presets/dual-ll/index.d.ts.map +1 -0
- package/dist/presets/dual-ll/index.js +15 -0
- package/dist/presets/dual-ll/index.js.map +1 -0
- package/dist/presets/full/index.d.ts.map +1 -1
- package/dist/presets/full/index.js +6 -4
- package/dist/presets/full/index.js.map +1 -1
- package/dist/presets/hls-ll/index.d.ts +4 -0
- package/dist/presets/hls-ll/index.d.ts.map +1 -0
- package/dist/presets/hls-ll/index.js +9 -0
- package/dist/presets/hls-ll/index.js.map +1 -0
- package/dist/presets/tiers.d.ts +16 -0
- package/dist/presets/tiers.d.ts.map +1 -1
- package/dist/presets/tiers.js +25 -0
- package/dist/presets/tiers.js.map +1 -1
- package/dist/protocols/dash-cmaf/index.d.ts +29 -1
- package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/index.js +9 -4
- package/dist/protocols/dash-cmaf/index.js.map +1 -1
- package/dist/protocols/dash-cmaf/parse.d.ts +8 -2
- package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/dash-cmaf/parse.js +121 -14
- package/dist/protocols/dash-cmaf/parse.js.map +1 -1
- package/dist/protocols/dash-live/index.d.ts +22 -0
- package/dist/protocols/dash-live/index.d.ts.map +1 -1
- package/dist/protocols/dash-live/index.js +77 -18
- package/dist/protocols/dash-live/index.js.map +1 -1
- package/dist/protocols/dash-ll/index.d.ts +27 -0
- package/dist/protocols/dash-ll/index.d.ts.map +1 -0
- package/dist/protocols/dash-ll/index.js +35 -0
- package/dist/protocols/dash-ll/index.js.map +1 -0
- package/dist/protocols/hls-cmaf/index.d.ts +23 -0
- package/dist/protocols/hls-cmaf/index.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/index.js +4 -4
- package/dist/protocols/hls-cmaf/index.js.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/lexer.js +7 -0
- package/dist/protocols/hls-cmaf/lexer.js.map +1 -1
- package/dist/protocols/hls-cmaf/parse.d.ts +28 -2
- package/dist/protocols/hls-cmaf/parse.d.ts.map +1 -1
- package/dist/protocols/hls-cmaf/parse.js +42 -6
- package/dist/protocols/hls-cmaf/parse.js.map +1 -1
- package/dist/protocols/hls-live/index.d.ts +65 -0
- package/dist/protocols/hls-live/index.d.ts.map +1 -1
- package/dist/protocols/hls-live/index.js +115 -16
- package/dist/protocols/hls-live/index.js.map +1 -1
- package/dist/protocols/hls-ll/index.d.ts +22 -0
- package/dist/protocols/hls-ll/index.d.ts.map +1 -0
- package/dist/protocols/hls-ll/index.js +32 -0
- package/dist/protocols/hls-ll/index.js.map +1 -0
- package/dist/protocols/hls-ll/parse.d.ts +45 -0
- package/dist/protocols/hls-ll/parse.d.ts.map +1 -0
- package/dist/protocols/hls-ll/parse.js +300 -0
- package/dist/protocols/hls-ll/parse.js.map +1 -0
- package/dist/stages/abr/index.d.ts.map +1 -1
- package/dist/stages/abr/index.js +6 -6
- package/dist/stages/abr/index.js.map +1 -1
- package/dist/stages/cmcd/index.d.ts.map +1 -1
- package/dist/stages/cmcd/index.js +12 -3
- package/dist/stages/cmcd/index.js.map +1 -1
- package/dist/stages/eme-core/index.d.ts +67 -2
- package/dist/stages/eme-core/index.d.ts.map +1 -1
- package/dist/stages/eme-core/index.js +191 -40
- package/dist/stages/eme-core/index.js.map +1 -1
- package/dist/stages/live-catchup/index.d.ts +42 -0
- package/dist/stages/live-catchup/index.d.ts.map +1 -0
- package/dist/stages/live-catchup/index.js +217 -0
- package/dist/stages/live-catchup/index.js.map +1 -0
- package/dist/stages/recovery/index.d.ts.map +1 -1
- package/dist/stages/recovery/index.js +6 -2
- package/dist/stages/recovery/index.js.map +1 -1
- package/dist/stages/text-ttml/images.d.ts +10 -0
- package/dist/stages/text-ttml/images.d.ts.map +1 -0
- package/dist/stages/text-ttml/images.js +71 -0
- package/dist/stages/text-ttml/images.js.map +1 -0
- package/dist/stages/text-ttml/index.d.ts +13 -0
- package/dist/stages/text-ttml/index.d.ts.map +1 -1
- package/dist/stages/text-ttml/index.js +26 -6
- package/dist/stages/text-ttml/index.js.map +1 -1
- package/dist/stages/text-ttml/parse.d.ts +5 -2
- package/dist/stages/text-ttml/parse.d.ts.map +1 -1
- package/dist/stages/text-ttml/parse.js +74 -2
- package/dist/stages/text-ttml/parse.js.map +1 -1
- package/dist/types/ir.d.ts +36 -0
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/kernel.d.ts +4 -0
- package/dist/types/kernel.d.ts.map +1 -1
- package/dist/types/kernel.js.map +1 -1
- package/dist/types/messages.d.ts +40 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/stage.d.ts +24 -5
- package/dist/types/stage.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
1
2
|
import { concat, sequenceNumberFor, writeInitSegment, writeMediaSegment } from "../fmp4/writer.js";
|
|
2
|
-
import { demux, unrollTimestamps } from "./demux.js";
|
|
3
|
+
import { STREAM_TYPE, demux, unrollTimestamps } from "./demux.js";
|
|
3
4
|
import { ccTriplesFromSei } from "../sei.js";
|
|
4
5
|
import { adtsFragment, parseAdts } from "../adts.js";
|
|
5
6
|
import { NAL_TYPE, accessUnitFromNals, nalType, splitNalUnits, spsDimensions, toAccessUnit } from "./h264.js";
|
|
7
|
+
import { HEVC_NAL_TYPE, hevcAccessUnitFromNals, hevcDecoderConfiguration, hevcNalType, hevcSpsInfo } from "./h265.js";
|
|
6
8
|
//#region src/containers/ts-transmux/transmux.ts
|
|
7
9
|
/**
|
|
8
10
|
* The transmux core: MPEG-TS bytes to a self-contained fragmented MP4. Each
|
|
@@ -42,6 +44,18 @@ function timedTags(streams, presentationStart, anchor) {
|
|
|
42
44
|
}
|
|
43
45
|
return tags;
|
|
44
46
|
}
|
|
47
|
+
const AVC = {
|
|
48
|
+
type: nalType,
|
|
49
|
+
delimiter: NAL_TYPE.accessUnitDelimiter,
|
|
50
|
+
unit: accessUnitFromNals,
|
|
51
|
+
seiHeader: 1
|
|
52
|
+
};
|
|
53
|
+
const HEVC = {
|
|
54
|
+
type: hevcNalType,
|
|
55
|
+
delimiter: HEVC_NAL_TYPE.accessUnitDelimiter,
|
|
56
|
+
unit: hevcAccessUnitFromNals,
|
|
57
|
+
seiHeader: 2
|
|
58
|
+
};
|
|
45
59
|
/**
|
|
46
60
|
* Reframes video access units. Access units do not align with PES packet
|
|
47
61
|
* boundaries in the wild: a picture's tail spills into the next PES packet,
|
|
@@ -51,7 +65,7 @@ function timedTags(streams, presentationStart, anchor) {
|
|
|
51
65
|
* no delimiters falls back to one unit per PES, which is correct when the muxer
|
|
52
66
|
* did align them.
|
|
53
67
|
*/
|
|
54
|
-
function frameAccessUnits(packets) {
|
|
68
|
+
function frameAccessUnits(packets, syntax) {
|
|
55
69
|
let total = 0;
|
|
56
70
|
for (const p of packets) total += p.data.byteLength;
|
|
57
71
|
const es = new Uint8Array(total);
|
|
@@ -67,8 +81,8 @@ function frameAccessUnits(packets) {
|
|
|
67
81
|
offset += p.data.byteLength;
|
|
68
82
|
}
|
|
69
83
|
const nals = splitNalUnits(es);
|
|
70
|
-
if (!nals.some((n) =>
|
|
71
|
-
unit: toAccessUnit(p.data),
|
|
84
|
+
if (!nals.some((n) => syntax.type(n) === syntax.delimiter)) return packets.map((p) => ({
|
|
85
|
+
unit: syntax === AVC ? toAccessUnit(p.data) : syntax.unit(splitNalUnits(p.data)),
|
|
72
86
|
pts: p.pts,
|
|
73
87
|
dts: p.dts
|
|
74
88
|
}));
|
|
@@ -81,14 +95,14 @@ function frameAccessUnits(packets) {
|
|
|
81
95
|
while (boundaryIndex + 1 < boundaries.length && boundaries[boundaryIndex + 1].offset <= groupOffset) boundaryIndex += 1;
|
|
82
96
|
const b = boundaries[boundaryIndex];
|
|
83
97
|
framed.push({
|
|
84
|
-
unit:
|
|
98
|
+
unit: syntax.unit(group),
|
|
85
99
|
pts: b.pts,
|
|
86
100
|
dts: b.dts
|
|
87
101
|
});
|
|
88
102
|
group = [];
|
|
89
103
|
};
|
|
90
104
|
for (const nal of nals) {
|
|
91
|
-
if (
|
|
105
|
+
if (syntax.type(nal) === syntax.delimiter && group.length > 0) flush();
|
|
92
106
|
if (group.length === 0) groupOffset = nal.byteOffset - es.byteOffset;
|
|
93
107
|
group.push(nal);
|
|
94
108
|
}
|
|
@@ -96,19 +110,24 @@ function frameAccessUnits(packets) {
|
|
|
96
110
|
return framed;
|
|
97
111
|
}
|
|
98
112
|
function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
99
|
-
var _ref, _sps, _ref2, _pps;
|
|
113
|
+
var _packets$, _ref, _sps, _ref2, _pps, _ref3, _vps;
|
|
100
114
|
if (packets.length === 0) return null;
|
|
101
|
-
const
|
|
115
|
+
const hevc = ((_packets$ = packets[0]) === null || _packets$ === void 0 ? void 0 : _packets$.streamType) === STREAM_TYPE.h265;
|
|
116
|
+
const syntax = hevc ? HEVC : AVC;
|
|
117
|
+
const framed = frameAccessUnits(packets, syntax);
|
|
102
118
|
const units = framed.map((f) => f.unit);
|
|
119
|
+
let vps = null;
|
|
103
120
|
let sps = null;
|
|
104
121
|
let pps = null;
|
|
105
122
|
for (const unit of units) {
|
|
123
|
+
if (unit.vps != null) vps = unit.vps;
|
|
106
124
|
if (unit.sps !== null) sps = unit.sps;
|
|
107
125
|
if (unit.pps !== null) pps = unit.pps;
|
|
108
126
|
}
|
|
109
127
|
sps = (_ref = (_sps = sps) !== null && _sps !== void 0 ? _sps : carried === null || carried === void 0 ? void 0 : carried.sps) !== null && _ref !== void 0 ? _ref : null;
|
|
110
128
|
pps = (_ref2 = (_pps = pps) !== null && _pps !== void 0 ? _pps : carried === null || carried === void 0 ? void 0 : carried.pps) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
111
|
-
|
|
129
|
+
vps = (_ref3 = (_vps = vps) !== null && _vps !== void 0 ? _vps : carried === null || carried === void 0 ? void 0 : carried.vps) !== null && _ref3 !== void 0 ? _ref3 : null;
|
|
130
|
+
if (sps === null || pps === null || hevc && vps === null) return null;
|
|
112
131
|
const dts = unrollTimestamps(framed.map((f) => f.dts));
|
|
113
132
|
const pts = unrollTimestamps(framed.map((f) => f.pts));
|
|
114
133
|
const base = Math.round(presentationStart * VIDEO_TIMESCALE);
|
|
@@ -119,7 +138,7 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
119
138
|
for (let i = 0; i < units.length; i += 1) {
|
|
120
139
|
const unit = units[i];
|
|
121
140
|
if (unit.sei.length === 0) continue;
|
|
122
|
-
const triples = unit.sei.flatMap((nal) => ccTriplesFromSei(nal));
|
|
141
|
+
const triples = unit.sei.flatMap((nal) => ccTriplesFromSei(nal, syntax.seiHeader));
|
|
123
142
|
if (triples.length === 0) continue;
|
|
124
143
|
const time = presentationStart + (pts[i] - firstPts) / VIDEO_TIMESCALE;
|
|
125
144
|
captions.push({
|
|
@@ -138,9 +157,9 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
138
157
|
isKeyframe: units[i].isKeyframe
|
|
139
158
|
});
|
|
140
159
|
}
|
|
141
|
-
const { width, height } = spsDimensions(sps);
|
|
160
|
+
const { width, height } = hevc ? hevcSpsInfo(sps) : spsDimensions(sps);
|
|
142
161
|
return {
|
|
143
|
-
config: {
|
|
162
|
+
config: _objectSpread2({
|
|
144
163
|
id: VIDEO_TRACK_ID,
|
|
145
164
|
kind: "video",
|
|
146
165
|
timescale: VIDEO_TIMESCALE,
|
|
@@ -148,14 +167,18 @@ function buildVideo(packets, presentationStart, wantCaptions, carried) {
|
|
|
148
167
|
pps,
|
|
149
168
|
width,
|
|
150
169
|
height
|
|
151
|
-
},
|
|
170
|
+
}, vps !== null ? { hvcC: hevcDecoderConfiguration(vps, sps, pps) } : {}),
|
|
152
171
|
fragment: {
|
|
153
172
|
trackId: VIDEO_TRACK_ID,
|
|
154
173
|
baseMediaDecodeTime: base,
|
|
155
174
|
samples
|
|
156
175
|
},
|
|
157
176
|
captions,
|
|
158
|
-
parameterSets: {
|
|
177
|
+
parameterSets: vps !== null ? {
|
|
178
|
+
sps,
|
|
179
|
+
pps,
|
|
180
|
+
vps
|
|
181
|
+
} : {
|
|
159
182
|
sps,
|
|
160
183
|
pps
|
|
161
184
|
}
|
|
@@ -168,7 +191,7 @@ function buildAudio(packets, presentationStart) {
|
|
|
168
191
|
return adtsFragment(adts, AUDIO_TRACK_ID, presentationStart);
|
|
169
192
|
}
|
|
170
193
|
function transmux(input, presentationStart = 0, wantCaptions = false, tracks = "all", parameterSets = null) {
|
|
171
|
-
var _video$captions,
|
|
194
|
+
var _video$captions, _ref4, _streams$video$, _streams$audio$, _video$parameterSets;
|
|
172
195
|
const streams = demux(input);
|
|
173
196
|
if (streams.notTransportStream) return {
|
|
174
197
|
bytes: null,
|
|
@@ -208,7 +231,7 @@ function transmux(input, presentationStart = 0, wantCaptions = false, tracks = "
|
|
|
208
231
|
notTransportStream: false,
|
|
209
232
|
empty: false,
|
|
210
233
|
captions: (_video$captions = video === null || video === void 0 ? void 0 : video.captions) !== null && _video$captions !== void 0 ? _video$captions : [],
|
|
211
|
-
metadata: timedTags(streams, presentationStart, (
|
|
234
|
+
metadata: timedTags(streams, presentationStart, (_ref4 = video !== null ? (_streams$video$ = streams.video[0]) === null || _streams$video$ === void 0 ? void 0 : _streams$video$.dts : (_streams$audio$ = streams.audio[0]) === null || _streams$audio$ === void 0 ? void 0 : _streams$audio$.pts) !== null && _ref4 !== void 0 ? _ref4 : null),
|
|
212
235
|
droppedAudio,
|
|
213
236
|
parameterSets: (_video$parameterSets = video === null || video === void 0 ? void 0 : video.parameterSets) !== null && _video$parameterSets !== void 0 ? _video$parameterSets : null
|
|
214
237
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/containers/webvtt.ts
|
|
3
3
|
/** `HH:MM:SS.mmm` or `MM:SS.mmm` to seconds, or null. */
|
|
4
4
|
function parseTimestamp(text) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { fourcc, viewOf } from "./mp4-box/index.js";
|
|
3
3
|
//#region src/containers/wvtt.ts
|
|
4
4
|
/** The child boxes of `bytes`, as type and payload. */
|
package/dist/es2015/eme/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectWithoutProperties.js";
|
|
3
|
+
import { fetchWithin } from "../kernel/transport.js";
|
|
3
4
|
import emeCore from "../stages/eme-core/index.js";
|
|
4
5
|
//#region src/eme/index.ts
|
|
5
6
|
/**
|
|
@@ -24,16 +25,16 @@ function attachEme(element, options = {}) {
|
|
|
24
25
|
drm = api;
|
|
25
26
|
},
|
|
26
27
|
request(url, init) {
|
|
27
|
-
var _init$method;
|
|
28
|
+
var _init$method, _init$timeoutMs;
|
|
28
29
|
const draft = {
|
|
29
30
|
url,
|
|
30
31
|
headers: _objectSpread2({}, init.headers)
|
|
31
32
|
};
|
|
32
33
|
requestHook === null || requestHook === void 0 || requestHook(draft);
|
|
33
|
-
return fetch(draft.url, _objectSpread2({
|
|
34
|
+
return fetchWithin((url, request) => fetch(url, request), draft.url, _objectSpread2({
|
|
34
35
|
method: (_init$method = init.method) !== null && _init$method !== void 0 ? _init$method : init.body !== void 0 ? "POST" : "GET",
|
|
35
36
|
headers: draft.headers
|
|
36
|
-
}, init.body !== void 0 ? { body: init.body } : {}));
|
|
37
|
+
}, init.body !== void 0 ? { body: init.body } : {}), (_init$timeoutMs = init.timeoutMs) !== null && _init$timeoutMs !== void 0 ? _init$timeoutMs : null, init.signal);
|
|
37
38
|
},
|
|
38
39
|
emit(event, payload) {
|
|
39
40
|
var _listeners$get;
|
|
@@ -52,6 +53,7 @@ function attachEme(element, options = {}) {
|
|
|
52
53
|
registerSwitchPolicy: noop,
|
|
53
54
|
registerTypeProbe: noop,
|
|
54
55
|
registerTimeProbe: noop,
|
|
56
|
+
registerChunkSplitter: noop,
|
|
55
57
|
reduce: noop,
|
|
56
58
|
dispatch: noop,
|
|
57
59
|
addRequestHook: () => noop,
|
package/dist/es2015/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { exportTrace, replay } from "./kernel/trace.js";
|
|
3
3
|
import { createBus } from "./kernel/bus.js";
|
|
4
4
|
import { createEffectRunner } from "./kernel/effects.js";
|
|
5
|
-
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.
|
|
5
|
+
import _asyncToGenerator from "./_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/asyncToGenerator.js";
|
|
6
6
|
import { createSegmentPreparer } from "./kernel/prepare.js";
|
|
7
7
|
import { cueFormat, normalizeMimeType } from "./kernel/mime.js";
|
|
8
8
|
import { findTrackSite, isTrick } from "./kernel/presentation.js";
|
|
@@ -71,6 +71,10 @@ function mattebox(options) {
|
|
|
71
71
|
const transport = createTransport(_objectSpread2(_objectSpread2({
|
|
72
72
|
absorb: prepare,
|
|
73
73
|
inflight: (token) => bus.getState().scheduling.inflight.get(token),
|
|
74
|
+
split: () => {
|
|
75
|
+
var _hooks$chunkSplitter;
|
|
76
|
+
return (_hooks$chunkSplitter = hooks.chunkSplitter) !== null && _hooks$chunkSplitter !== void 0 ? _hooks$chunkSplitter : null;
|
|
77
|
+
},
|
|
74
78
|
acceptManifestType: (contentType) => {
|
|
75
79
|
const type = normalizeMimeType(contentType);
|
|
76
80
|
return !(type.startsWith("audio/") || type.startsWith("video/")) || accepts(type);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/kernel/append-queue.ts
|
|
3
3
|
function isQuotaError(err) {
|
|
4
4
|
return err instanceof DOMException && err.name === "QuotaExceededError";
|
|
@@ -13,6 +13,7 @@ function createStageContext(deps) {
|
|
|
13
13
|
let registeredPolicy = false;
|
|
14
14
|
let registeredProbe = false;
|
|
15
15
|
let registeredTimeProbe = false;
|
|
16
|
+
let registeredSplitter = false;
|
|
16
17
|
return {
|
|
17
18
|
ctx: {
|
|
18
19
|
element: deps.element,
|
|
@@ -72,6 +73,11 @@ function createStageContext(deps) {
|
|
|
72
73
|
deps.hooks.timeProbe = probe;
|
|
73
74
|
registeredTimeProbe = true;
|
|
74
75
|
},
|
|
76
|
+
registerChunkSplitter(split) {
|
|
77
|
+
if (deps.hooks.chunkSplitter != null) throw new Error("a chunk splitter is already registered");
|
|
78
|
+
deps.hooks.chunkSplitter = split;
|
|
79
|
+
registeredSplitter = true;
|
|
80
|
+
},
|
|
75
81
|
reduce(slice, reducer) {
|
|
76
82
|
deps.slices.push([slice, reducer]);
|
|
77
83
|
},
|
|
@@ -100,6 +106,7 @@ function createStageContext(deps) {
|
|
|
100
106
|
if (registeredPolicy) deps.hooks.switchPolicy = null;
|
|
101
107
|
if (registeredProbe) deps.hooks.typeProbe = null;
|
|
102
108
|
if (registeredTimeProbe) deps.hooks.timeProbe = null;
|
|
109
|
+
if (registeredSplitter) deps.hooks.chunkSplitter = null;
|
|
103
110
|
}
|
|
104
111
|
};
|
|
105
112
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { createBus } from "./bus.js";
|
|
3
3
|
import { createEffectRunner } from "./effects.js";
|
|
4
4
|
import { createSegmentPreparer } from "./prepare.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { createAppendQueue } from "./append-queue.js";
|
|
3
3
|
import { createEvictor } from "./evictor.js";
|
|
4
4
|
//#region src/kernel/mse.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import _asyncToGenerator from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/asyncToGenerator.js";
|
|
3
3
|
//#region src/kernel/prepare.ts
|
|
4
4
|
/**
|
|
5
5
|
* The boundary meta a transform and the probe receive. The content type
|
|
@@ -27,7 +27,7 @@ function createSegmentPreparer(deps) {
|
|
|
27
27
|
const chains = /* @__PURE__ */ new Map();
|
|
28
28
|
return (fact) => {
|
|
29
29
|
var _chains$get;
|
|
30
|
-
if (fact.type !== "SEGMENT_LOADED" || fact.token === void 0) {
|
|
30
|
+
if (fact.type !== "SEGMENT_LOADED" && fact.type !== "SEGMENT_CHUNK" || fact.token === void 0) {
|
|
31
31
|
deps.absorb(fact);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { tickAfter } from "./effects.js";
|
|
3
3
|
import { cueFormat, normalizeMimeType, typeString } from "./mime.js";
|
|
4
4
|
import { findRendition, findTrackSite, isTrick } from "./presentation.js";
|
|
5
5
|
import { applyRefresh } from "./refresh.js";
|
|
6
6
|
import { reconciledOffset, segmentAtTime } from "./timeline.js";
|
|
7
7
|
import { bufferedEndFrom, reachesEnd, schedule } from "./scheduler.js";
|
|
8
|
-
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.
|
|
8
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectWithoutProperties.js";
|
|
9
9
|
import { activeAudio, audioGroup, audioInGroup, availableGroups, canSwitchTo, codecFamily, createArbiter, planPinApply, withDeadGroups } from "./rendition-select.js";
|
|
10
10
|
import { sbIdFor } from "./sinks/mse-sink.js";
|
|
11
11
|
//#region src/kernel/reducer.ts
|
|
@@ -236,11 +236,66 @@ function segmentedAt(candidates, time, periodStart) {
|
|
|
236
236
|
* beside video, a text cue, or a playlist is a small transfer whose time
|
|
237
237
|
* is latency, not bandwidth.
|
|
238
238
|
*/
|
|
239
|
+
/**
|
|
240
|
+
* The offset an append of media bytes takes. The first media segment to
|
|
241
|
+
* land in an epoch settles it for every buffer: its presentation start
|
|
242
|
+
* minus the decode time the probe read from its bytes, or the manifest's
|
|
243
|
+
* prediction when nothing read one. Later segments of the epoch, on any
|
|
244
|
+
* buffer, apply the settled value, so audio and video keep the alignment
|
|
245
|
+
* their shared media clock gives them: one offset per timeline, as
|
|
246
|
+
* videojs-http-streaming takes it from its main loader. Playlist
|
|
247
|
+
* discontinuities and period boundaries both land here.
|
|
248
|
+
*/
|
|
249
|
+
function placeAppend(timeline, matched, mediaStart) {
|
|
250
|
+
const effects = [];
|
|
251
|
+
let reconciled = timeline.reconciled;
|
|
252
|
+
let offset = matched.epoch === void 0 ? void 0 : reconciled.get(matched.epoch);
|
|
253
|
+
if (offset === void 0 && matched.epoch !== void 0 && matched.seq >= 0 && matched.segmentStart !== void 0) {
|
|
254
|
+
const settled = mediaStart !== void 0 ? reconciledOffset(matched.segmentStart, mediaStart) : matched.timestampOffset;
|
|
255
|
+
if (settled !== void 0) {
|
|
256
|
+
offset = settled;
|
|
257
|
+
reconciled = new Map(reconciled).set(matched.epoch, settled);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (offset === void 0) offset = matched.timestampOffset;
|
|
261
|
+
let periodOffsets = timeline.periodOffsets;
|
|
262
|
+
if (offset !== void 0 && periodOffsets.get(matched.sbId) !== offset) {
|
|
263
|
+
effects.push({
|
|
264
|
+
kind: "setTimestampOffset",
|
|
265
|
+
sbId: matched.sbId,
|
|
266
|
+
offset
|
|
267
|
+
});
|
|
268
|
+
periodOffsets = new Map(periodOffsets).set(matched.sbId, offset);
|
|
269
|
+
}
|
|
270
|
+
if (periodOffsets === timeline.periodOffsets && reconciled === timeline.reconciled) return {
|
|
271
|
+
timeline,
|
|
272
|
+
effects
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
timeline: _objectSpread2(_objectSpread2({}, timeline), {}, {
|
|
276
|
+
periodOffsets,
|
|
277
|
+
reconciled
|
|
278
|
+
}),
|
|
279
|
+
effects
|
|
280
|
+
};
|
|
281
|
+
}
|
|
239
282
|
function samplesThroughput(state, request) {
|
|
240
283
|
var _state$tracks$active$;
|
|
241
284
|
const lead = (_state$tracks$active$ = state.tracks.active.get("video")) !== null && _state$tracks$active$ !== void 0 ? _state$tracks$active$ : state.tracks.active.get("audio");
|
|
242
285
|
return lead === void 0 ? request.renditionId === void 0 : request.trackId === lead;
|
|
243
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Seconds before the live edge that a jump to it lands. The edge often sits
|
|
289
|
+
* exactly on a segment boundary, and the segment that starts there may not
|
|
290
|
+
* start with a key frame; the scheduler then fetches the one before. A seek
|
|
291
|
+
* to that one's exact end, with media arriving a piece at a time, makes
|
|
292
|
+
* WebKit's GStreamer backend fail to decode (WebKitGTK and WPE); a target
|
|
293
|
+
* inside it does not.
|
|
294
|
+
*/
|
|
295
|
+
const EDGE_INSET = .05;
|
|
296
|
+
function edgeStart(spanStart, edge) {
|
|
297
|
+
return Math.max(spanStart, edge - EDGE_INSET);
|
|
298
|
+
}
|
|
244
299
|
/** Abort effects for every matching in-flight request, plus the state with them removed. */
|
|
245
300
|
function abortInflight(state, trackId) {
|
|
246
301
|
const effects = [];
|
|
@@ -379,7 +434,7 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
379
434
|
const [next, aborts] = abortInflight(state);
|
|
380
435
|
return [_objectSpread2(_objectSpread2({}, next), {}, { scheduling: clearRepeat(next.scheduling) }), [...aborts, {
|
|
381
436
|
kind: "seekElement",
|
|
382
|
-
to: state.live.edge
|
|
437
|
+
to: edgeStart(state.live.span.start, state.live.edge)
|
|
383
438
|
}]];
|
|
384
439
|
}
|
|
385
440
|
case "SELECT_TRACK": {
|
|
@@ -697,7 +752,24 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
697
752
|
const [failed, report] = failManifest(stopped, _objectSpread2(_objectSpread2({}, msg.error), {}, { fatal: true }), { context: msg.error.context });
|
|
698
753
|
return [failed, [...aborts, ...report]];
|
|
699
754
|
}
|
|
755
|
+
case "SEGMENT_CHUNK": {
|
|
756
|
+
const matched = state.scheduling.inflight.get(msg.token);
|
|
757
|
+
if ((matched === null || matched === void 0 ? void 0 : matched.sbId) === void 0) return [state, []];
|
|
758
|
+
const buffer = state.buffers.get(matched.sbId);
|
|
759
|
+
if (buffer === void 0 || buffer.initFor !== matched.renditionId) return [state, []];
|
|
760
|
+
const placed = placeAppend(state.timeline, _objectSpread2(_objectSpread2({}, matched), {}, { sbId: matched.sbId }), msg.mediaStart);
|
|
761
|
+
const buffers = new Map(state.buffers).set(matched.sbId, _objectSpread2(_objectSpread2({}, buffer), {}, { pendingAppends: buffer.pendingAppends + 1 }));
|
|
762
|
+
return [_objectSpread2(_objectSpread2({}, state), {}, {
|
|
763
|
+
buffers,
|
|
764
|
+
timeline: placed.timeline
|
|
765
|
+
}), [...placed.effects, {
|
|
766
|
+
kind: "append",
|
|
767
|
+
sbId: matched.sbId,
|
|
768
|
+
data: msg.bytes
|
|
769
|
+
}]];
|
|
770
|
+
}
|
|
700
771
|
case "SEGMENT_LOADED": {
|
|
772
|
+
var _msg$transfer;
|
|
701
773
|
let matched = null;
|
|
702
774
|
if (msg.token !== void 0) {
|
|
703
775
|
var _state$scheduling$inf;
|
|
@@ -709,7 +781,11 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
709
781
|
if (matched === null) return [state, []];
|
|
710
782
|
const inflight = new Map(state.scheduling.inflight);
|
|
711
783
|
inflight.delete(matched.token);
|
|
712
|
-
const
|
|
784
|
+
const sample = (_msg$transfer = msg.transfer) !== null && _msg$transfer !== void 0 ? _msg$transfer : {
|
|
785
|
+
bytes: msg.size,
|
|
786
|
+
ms: msg.rtt
|
|
787
|
+
};
|
|
788
|
+
const sampleBps = sample.ms > 0 && sample.bytes >= cfg.ewmaMinSampleBytes && samplesThroughput(state, matched) ? sample.bytes * 8e3 / sample.ms : null;
|
|
713
789
|
const stats = sampleBps === null ? state.stats : {
|
|
714
790
|
throughputEwma: ewma(state.stats.throughputEwma, sampleBps, cfg.ewmaAlpha),
|
|
715
791
|
throughputFastEwma: ewma(state.stats.throughputFastEwma, sampleBps, cfg.ewmaFastAlpha)
|
|
@@ -810,30 +886,11 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
810
886
|
initFor
|
|
811
887
|
}
|
|
812
888
|
}]];
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
offset = settled;
|
|
819
|
-
reconciled = new Map(reconciled).set(matched.epoch, settled);
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
if (offset === void 0) offset = matched.timestampOffset;
|
|
823
|
-
let periodOffsets = state.timeline.periodOffsets;
|
|
824
|
-
if (offset !== void 0 && periodOffsets.get(matched.sbId) !== offset) {
|
|
825
|
-
effects.push({
|
|
826
|
-
kind: "setTimestampOffset",
|
|
827
|
-
sbId: matched.sbId,
|
|
828
|
-
offset
|
|
829
|
-
});
|
|
830
|
-
periodOffsets = new Map(periodOffsets).set(matched.sbId, offset);
|
|
831
|
-
}
|
|
832
|
-
if (periodOffsets !== state.timeline.periodOffsets || reconciled !== state.timeline.reconciled) timeline = _objectSpread2(_objectSpread2({}, state.timeline), {}, {
|
|
833
|
-
periodOffsets,
|
|
834
|
-
reconciled
|
|
835
|
-
});
|
|
836
|
-
effects.push({
|
|
889
|
+
const placed = placeAppend(state.timeline, _objectSpread2(_objectSpread2({}, matched), {}, { sbId: matched.sbId }), msg.mediaStart);
|
|
890
|
+
effects.push(...placed.effects);
|
|
891
|
+
timeline = placed.timeline;
|
|
892
|
+
const appends = msg.bytes.byteLength > 0 || matched.chunked !== true;
|
|
893
|
+
if (appends) effects.push({
|
|
837
894
|
kind: "append",
|
|
838
895
|
sbId: matched.sbId,
|
|
839
896
|
data: msg.bytes
|
|
@@ -853,7 +910,7 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
853
910
|
};
|
|
854
911
|
appended = [...((_appended2 = appended) !== null && _appended2 !== void 0 ? _appended2 : []).filter((seg) => seg.seq !== seq || seg.renditionId !== renditionId).slice(-31), entry];
|
|
855
912
|
}
|
|
856
|
-
nextBuffers.set(matched.sbId, _objectSpread2(_objectSpread2({}, buffer), {}, { pendingAppends: buffer.pendingAppends + 1 }, appended !== void 0 ? { appended } : {}));
|
|
913
|
+
nextBuffers.set(matched.sbId, _objectSpread2(_objectSpread2({}, buffer), {}, { pendingAppends: buffer.pendingAppends + (appends ? 1 : 0) }, appended !== void 0 ? { appended } : {}));
|
|
857
914
|
buffers = nextBuffers;
|
|
858
915
|
}
|
|
859
916
|
if (matched.sbId === sbIdFor("video") && matched.renditionId !== void 0 && matched.segmentStart !== void 0) {
|
|
@@ -880,6 +937,7 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
880
937
|
var _msg$status2;
|
|
881
938
|
const inflight = new Map(state.scheduling.inflight);
|
|
882
939
|
for (const [token, request] of inflight) if (request.trackId === msg.trackId && request.seq === msg.seq) inflight.delete(token);
|
|
940
|
+
if (msg.preload === true) return [_objectSpread2(_objectSpread2({}, state), {}, { scheduling: _objectSpread2(_objectSpread2({}, state.scheduling), {}, { inflight }) }), []];
|
|
883
941
|
if (msg.trackId === "manifest") {
|
|
884
942
|
var _msg$error$context, _msg$status;
|
|
885
943
|
const contentType = (_msg$error$context = msg.error.context) === null || _msg$error$context === void 0 ? void 0 : _msg$error$context.contentType;
|
|
@@ -1073,12 +1131,13 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
1073
1131
|
end: msg.end
|
|
1074
1132
|
});
|
|
1075
1133
|
if (firstWindow && msg.edge > state.playback.currentTime + 1) {
|
|
1076
|
-
const
|
|
1134
|
+
const to = edgeStart(msg.start, msg.edge);
|
|
1135
|
+
const [scheduled, effects] = driveScheduling(_objectSpread2(_objectSpread2({}, withLive), {}, { playback: _objectSpread2(_objectSpread2({}, withLive.playback), {}, { currentTime: to }) }), hooks, cfg);
|
|
1077
1136
|
return [scheduled, [
|
|
1078
1137
|
...spanEffects,
|
|
1079
1138
|
{
|
|
1080
1139
|
kind: "seekElement",
|
|
1081
|
-
to
|
|
1140
|
+
to
|
|
1082
1141
|
},
|
|
1083
1142
|
...effects
|
|
1084
1143
|
]];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/kernel/refresh.ts
|
|
3
3
|
/** The presentation with the refresh merged, or null when it names no rendition the presentation holds. */
|
|
4
4
|
function applyRefresh(presentation, refresh) {
|
|
@@ -27,7 +27,7 @@ function applyRefresh(presentation, refresh) {
|
|
|
27
27
|
}
|
|
28
28
|
return _objectSpread2(_objectSpread2({}, presentation), {}, {
|
|
29
29
|
isLive: true,
|
|
30
|
-
live: _objectSpread2(_objectSpread2(_objectSpread2({}, presentation.live), refresh.updatePeriod !== void 0 ? { updatePeriod: refresh.updatePeriod } : {}), refresh.dateAnchor !== void 0 ? { dateAnchor: refresh.dateAnchor } : {}),
|
|
30
|
+
live: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, presentation.live), refresh.updatePeriod !== void 0 ? { updatePeriod: refresh.updatePeriod } : {}), refresh.holdBack !== void 0 ? { holdBack: refresh.holdBack } : {}), refresh.lowLatency !== void 0 ? { lowLatency: refresh.lowLatency } : {}), refresh.dateAnchor !== void 0 ? { dateAnchor: refresh.dateAnchor } : {}),
|
|
31
31
|
periods
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
import { findRendition, findTrackSite } from "./presentation.js";
|
|
3
3
|
import { segmentAtTime } from "./timeline.js";
|
|
4
4
|
import { bufferedEndFrom } from "./scheduler.js";
|
|
5
|
-
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.
|
|
5
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectWithoutProperties.js";
|
|
6
6
|
//#region src/kernel/rendition-select.ts
|
|
7
7
|
const _excluded = [
|
|
8
8
|
"maxHeight",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import { buildEpochs, epochForSeq, epochKey, segmentAtTime, timestampOffsetFor } from "./timeline.js";
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { buildEpochs, epochForSeq, epochKey, isIndexed, segmentAtTime, timestampOffsetFor } from "./timeline.js";
|
|
3
3
|
//#region src/kernel/scheduler.ts
|
|
4
4
|
const DEFAULT_GAP_TOLERANCE = .25;
|
|
5
5
|
/**
|
|
@@ -58,6 +58,27 @@ function received(track, seq) {
|
|
|
58
58
|
const id = track.rendition.id;
|
|
59
59
|
return ((_track$appended = track.appended) === null || _track$appended === void 0 ? void 0 : _track$appended.some((entry) => entry.seq === seq && entry.renditionId === id)) === true;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* The entry to fetch for `segment` so the decoder gets a frame it can start
|
|
63
|
+
* from. An entry marked not independent (a low-latency part that starts
|
|
64
|
+
* without a key frame, RFC 8216bis §4.4.4.9) only continues the entry
|
|
65
|
+
* before it. When this rendition's buffer did not receive that entry (a
|
|
66
|
+
* switch, a seek, the start), the run begins at the latest independent
|
|
67
|
+
* entry before it, and then continues entry by entry, over media another
|
|
68
|
+
* rendition already buffered.
|
|
69
|
+
*/
|
|
70
|
+
function startable(track, segment) {
|
|
71
|
+
const list = track.rendition.segments;
|
|
72
|
+
if (segment.independent !== false || !Array.isArray(list)) return segment;
|
|
73
|
+
const entries = list;
|
|
74
|
+
const index = entries.findIndex((entry) => entry.seq === segment.seq);
|
|
75
|
+
for (let i = index - 1; i >= 0; i -= 1) {
|
|
76
|
+
const entry = entries[i];
|
|
77
|
+
if (received(track, entry.seq)) return entries[i + 1];
|
|
78
|
+
if (entry.independent !== false) return entry;
|
|
79
|
+
}
|
|
80
|
+
return segment;
|
|
81
|
+
}
|
|
61
82
|
function schedule(input) {
|
|
62
83
|
var _input$gapToleranceSe;
|
|
63
84
|
const tolerance = (_input$gapToleranceSe = input.gapToleranceSeconds) !== null && _input$gapToleranceSe !== void 0 ? _input$gapToleranceSe : DEFAULT_GAP_TOLERANCE;
|
|
@@ -65,7 +86,7 @@ function schedule(input) {
|
|
|
65
86
|
const requests = [];
|
|
66
87
|
let tokenSeq = input.tokenSeq;
|
|
67
88
|
for (const track of input.tracks) {
|
|
68
|
-
var _input$reconciled;
|
|
89
|
+
var _addressing$availabil, _input$reconciled;
|
|
69
90
|
if (track.inflight.length > 0) continue;
|
|
70
91
|
const now = measuredFrom(input.currentTime, input.duration);
|
|
71
92
|
const bufferedEnd = bufferedEndFrom(track.ranges, now, tolerance);
|
|
@@ -94,7 +115,11 @@ function schedule(input) {
|
|
|
94
115
|
segment = segmentAtTime(track.rendition.segments, segment.start + segment.duration + tolerance, track.period.start);
|
|
95
116
|
}
|
|
96
117
|
if (segment === null) continue;
|
|
97
|
-
|
|
118
|
+
segment = startable(track, segment);
|
|
119
|
+
const addressing = track.rendition.segments;
|
|
120
|
+
const early = isIndexed(addressing) ? Math.min((_addressing$availabil = addressing.availabilityOffset) !== null && _addressing$availabil !== void 0 ? _addressing$availabil : 0, segment.duration) : 0;
|
|
121
|
+
if (input.liveWindow != null && segment.preload !== true && segment.start + segment.duration - early > input.liveWindow.end) continue;
|
|
122
|
+
const chunked = early > 0 && isIndexed(addressing) && addressing.chunked === true;
|
|
98
123
|
const epochs = buildEpochs([{
|
|
99
124
|
period: track.period,
|
|
100
125
|
rendition: track.rendition
|
|
@@ -109,7 +134,7 @@ function schedule(input) {
|
|
|
109
134
|
token,
|
|
110
135
|
url: segment.url
|
|
111
136
|
}, segment.byteRange !== void 0 ? { range: segment.byteRange } : {}));
|
|
112
|
-
requests.push(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
137
|
+
requests.push(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
113
138
|
token,
|
|
114
139
|
trackId: track.trackId,
|
|
115
140
|
seq: segment.seq,
|
|
@@ -117,7 +142,7 @@ function schedule(input) {
|
|
|
117
142
|
renditionId: track.rendition.id,
|
|
118
143
|
segmentStart: segment.start,
|
|
119
144
|
segmentDuration: segment.duration
|
|
120
|
-
}, track.sbId !== void 0 ? { sbId: track.sbId } : {}), epoch !== null ? { timestampOffset: timestampOffsetFor(epoch) } : {}), key !== void 0 ? { epoch: key } : {}));
|
|
145
|
+
}, segment.preload === true ? { preload: true } : {}), chunked ? { chunked: true } : {}), track.sbId !== void 0 ? { sbId: track.sbId } : {}), epoch !== null ? { timestampOffset: timestampOffsetFor(epoch) } : {}), key !== void 0 ? { epoch: key } : {}));
|
|
121
146
|
}
|
|
122
147
|
return {
|
|
123
148
|
effects,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
//#region src/kernel/timeline.ts
|
|
3
3
|
function isIndexed(addressing) {
|
|
4
4
|
return !Array.isArray(addressing) && addressing.kind === "indexed";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/objectSpread2.js";
|
|
2
2
|
function isBytes(value) {
|
|
3
3
|
return value instanceof ArrayBuffer || ArrayBuffer.isView(value);
|
|
4
4
|
}
|