mattebox 0.13.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 +42 -6
- package/dist/es2015/kernel/append-queue.js +1 -1
- package/dist/es2015/kernel/context.js +7 -0
- package/dist/es2015/kernel/dry-run.js +179 -0
- package/dist/es2015/kernel/lifecycle.js +6 -2
- package/dist/es2015/kernel/mse.js +1 -1
- package/dist/es2015/kernel/prepare.js +3 -3
- package/dist/es2015/kernel/reducer.js +105 -33
- 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 +235 -49
- 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 +8 -8
- package/dist/es2015/presets/hls-ll/index.js +14 -0
- package/dist/es2015/presets/tiers.js +29 -5
- 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 +28 -1
- 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/dry-run.d.ts +27 -0
- package/dist/kernel/dry-run.d.ts.map +1 -0
- package/dist/kernel/dry-run.js +198 -0
- package/dist/kernel/dry-run.js.map +1 -0
- package/dist/kernel/lifecycle.d.ts +5 -7
- package/dist/kernel/lifecycle.d.ts.map +1 -1
- package/dist/kernel/lifecycle.js +4 -0
- 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 +117 -42
- 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 +68 -10
- package/dist/kernel/transport.d.ts.map +1 -1
- package/dist/kernel/transport.js +232 -37
- 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.js +8 -8
- 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 +17 -2
- package/dist/presets/tiers.d.ts.map +1 -1
- package/dist/presets/tiers.js +26 -2
- 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/facade.d.ts +15 -3
- package/dist/types/facade.d.ts.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 +55 -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,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 = [];
|
|
@@ -263,7 +318,12 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
263
318
|
return [_objectSpread2(_objectSpread2({}, state), {}, { lifecycle: { phase: "attaching" } }), []];
|
|
264
319
|
case "DETACH": {
|
|
265
320
|
const [, aborts] = abortInflight(state);
|
|
266
|
-
|
|
321
|
+
const fresh = initialState(cfg);
|
|
322
|
+
const { throughputEwma, throughputFastEwma } = state.stats;
|
|
323
|
+
return [_objectSpread2(_objectSpread2({}, fresh), {}, { stats: _objectSpread2(_objectSpread2({}, fresh.stats), {}, {
|
|
324
|
+
throughputEwma,
|
|
325
|
+
throughputFastEwma
|
|
326
|
+
}) }), aborts];
|
|
267
327
|
}
|
|
268
328
|
case "LOAD": {
|
|
269
329
|
if (state.lifecycle.phase === "idle") return reject(state, msg.type, "not attached");
|
|
@@ -286,7 +346,15 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
286
346
|
seq: 0,
|
|
287
347
|
url: msg.url
|
|
288
348
|
});
|
|
289
|
-
|
|
349
|
+
const seed = msg.seed;
|
|
350
|
+
const seeded = seed === void 0 ? state : _objectSpread2(_objectSpread2({}, state), {}, {
|
|
351
|
+
stats: _objectSpread2(_objectSpread2({}, state.stats), {}, {
|
|
352
|
+
throughputEwma: seed.throughputEwma,
|
|
353
|
+
throughputFastEwma: seed.throughputFastEwma
|
|
354
|
+
}),
|
|
355
|
+
quality: _objectSpread2(_objectSpread2({}, state.quality), {}, { constraints: new Map(seed.constraints) })
|
|
356
|
+
});
|
|
357
|
+
return [_objectSpread2(_objectSpread2({}, seeded), {}, {
|
|
290
358
|
lifecycle: { phase: "loading" },
|
|
291
359
|
scheduling: _objectSpread2(_objectSpread2({}, state.scheduling), {}, {
|
|
292
360
|
inflight,
|
|
@@ -366,7 +434,7 @@ function reduceCommand(state, msg, cfg, hooks) {
|
|
|
366
434
|
const [next, aborts] = abortInflight(state);
|
|
367
435
|
return [_objectSpread2(_objectSpread2({}, next), {}, { scheduling: clearRepeat(next.scheduling) }), [...aborts, {
|
|
368
436
|
kind: "seekElement",
|
|
369
|
-
to: state.live.edge
|
|
437
|
+
to: edgeStart(state.live.span.start, state.live.edge)
|
|
370
438
|
}]];
|
|
371
439
|
}
|
|
372
440
|
case "SELECT_TRACK": {
|
|
@@ -684,7 +752,24 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
684
752
|
const [failed, report] = failManifest(stopped, _objectSpread2(_objectSpread2({}, msg.error), {}, { fatal: true }), { context: msg.error.context });
|
|
685
753
|
return [failed, [...aborts, ...report]];
|
|
686
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
|
+
}
|
|
687
771
|
case "SEGMENT_LOADED": {
|
|
772
|
+
var _msg$transfer;
|
|
688
773
|
let matched = null;
|
|
689
774
|
if (msg.token !== void 0) {
|
|
690
775
|
var _state$scheduling$inf;
|
|
@@ -696,7 +781,11 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
696
781
|
if (matched === null) return [state, []];
|
|
697
782
|
const inflight = new Map(state.scheduling.inflight);
|
|
698
783
|
inflight.delete(matched.token);
|
|
699
|
-
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;
|
|
700
789
|
const stats = sampleBps === null ? state.stats : {
|
|
701
790
|
throughputEwma: ewma(state.stats.throughputEwma, sampleBps, cfg.ewmaAlpha),
|
|
702
791
|
throughputFastEwma: ewma(state.stats.throughputFastEwma, sampleBps, cfg.ewmaFastAlpha)
|
|
@@ -797,30 +886,11 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
797
886
|
initFor
|
|
798
887
|
}
|
|
799
888
|
}]];
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
offset = settled;
|
|
806
|
-
reconciled = new Map(reconciled).set(matched.epoch, settled);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
if (offset === void 0) offset = matched.timestampOffset;
|
|
810
|
-
let periodOffsets = state.timeline.periodOffsets;
|
|
811
|
-
if (offset !== void 0 && periodOffsets.get(matched.sbId) !== offset) {
|
|
812
|
-
effects.push({
|
|
813
|
-
kind: "setTimestampOffset",
|
|
814
|
-
sbId: matched.sbId,
|
|
815
|
-
offset
|
|
816
|
-
});
|
|
817
|
-
periodOffsets = new Map(periodOffsets).set(matched.sbId, offset);
|
|
818
|
-
}
|
|
819
|
-
if (periodOffsets !== state.timeline.periodOffsets || reconciled !== state.timeline.reconciled) timeline = _objectSpread2(_objectSpread2({}, state.timeline), {}, {
|
|
820
|
-
periodOffsets,
|
|
821
|
-
reconciled
|
|
822
|
-
});
|
|
823
|
-
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({
|
|
824
894
|
kind: "append",
|
|
825
895
|
sbId: matched.sbId,
|
|
826
896
|
data: msg.bytes
|
|
@@ -840,7 +910,7 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
840
910
|
};
|
|
841
911
|
appended = [...((_appended2 = appended) !== null && _appended2 !== void 0 ? _appended2 : []).filter((seg) => seg.seq !== seq || seg.renditionId !== renditionId).slice(-31), entry];
|
|
842
912
|
}
|
|
843
|
-
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 } : {}));
|
|
844
914
|
buffers = nextBuffers;
|
|
845
915
|
}
|
|
846
916
|
if (matched.sbId === sbIdFor("video") && matched.renditionId !== void 0 && matched.segmentStart !== void 0) {
|
|
@@ -867,6 +937,7 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
867
937
|
var _msg$status2;
|
|
868
938
|
const inflight = new Map(state.scheduling.inflight);
|
|
869
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 }) }), []];
|
|
870
941
|
if (msg.trackId === "manifest") {
|
|
871
942
|
var _msg$error$context, _msg$status;
|
|
872
943
|
const contentType = (_msg$error$context = msg.error.context) === null || _msg$error$context === void 0 ? void 0 : _msg$error$context.contentType;
|
|
@@ -1060,12 +1131,13 @@ function reduceFact(state, msg, cfg, hooks) {
|
|
|
1060
1131
|
end: msg.end
|
|
1061
1132
|
});
|
|
1062
1133
|
if (firstWindow && msg.edge > state.playback.currentTime + 1) {
|
|
1063
|
-
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);
|
|
1064
1136
|
return [scheduled, [
|
|
1065
1137
|
...spanEffects,
|
|
1066
1138
|
{
|
|
1067
1139
|
kind: "seekElement",
|
|
1068
|
-
to
|
|
1140
|
+
to
|
|
1069
1141
|
},
|
|
1070
1142
|
...effects
|
|
1071
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
|
}
|