@torrent-tv/proxy 2.106.1 → 2.107.1
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/package.json
CHANGED
|
@@ -2219,60 +2219,78 @@ export class Renditions {
|
|
|
2219
2219
|
this.#host.outputs.touch(already);
|
|
2220
2220
|
return already;
|
|
2221
2221
|
}
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
transcodeAudio
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
:
|
|
2274
|
-
|
|
2275
|
-
|
|
2222
|
+
const waitStartedAt = performance.now();
|
|
2223
|
+
const waitFields = {
|
|
2224
|
+
process: "P6.a",
|
|
2225
|
+
baseSessionId: base.id,
|
|
2226
|
+
trackIndex,
|
|
2227
|
+
consumerId,
|
|
2228
|
+
audioMode: transcodeAudio ? "transcode" : "copy"
|
|
2229
|
+
};
|
|
2230
|
+
this.#host.observeWait?.(base.file.sourceKey, "process", { ...waitFields, phase: "begin", at: waitStartedAt });
|
|
2231
|
+
let waitOutcome = "error";
|
|
2232
|
+
try {
|
|
2233
|
+
const rendition = await this.#host.createOrGetSession({
|
|
2234
|
+
sourceKey: base.file.sourceKey,
|
|
2235
|
+
fileIndex: base.file.fileIndex,
|
|
2236
|
+
// No picture at all: the video flag says what to do with a video stream
|
|
2237
|
+
// this output does not carry.
|
|
2238
|
+
transcodeVideo: false,
|
|
2239
|
+
transcodeAudio,
|
|
2240
|
+
fileName: base.file.name,
|
|
2241
|
+
// Opened by nobody in particular, as a step is.
|
|
2242
|
+
consumerId: "",
|
|
2243
|
+
audioTrackIndex: trackIndex,
|
|
2244
|
+
audioOnly: true,
|
|
2245
|
+
// Where the viewer is, so the rendition starts with the picture rather
|
|
2246
|
+
// than at the beginning of the file. Read the same way a quality variant
|
|
2247
|
+
// reads it: the base's own field is only written by a seek or by a
|
|
2248
|
+
// segment IT served, so on a resume-from-position open it is still unset
|
|
2249
|
+
// while the player is asking for segment #537 — and the audio would begin
|
|
2250
|
+
// at zero and never catch up, since nothing treats a far request as a
|
|
2251
|
+
// seek. The accessor falls back to the last segment actually requested.
|
|
2252
|
+
// Where the PICTURE is, not where it has been read to.
|
|
2253
|
+
//
|
|
2254
|
+
// The position this class keeps is written by the segments a session
|
|
2255
|
+
// serves, so it is the READ head, and the viewer's picture sits behind it
|
|
2256
|
+
// by everything the player has buffered. Started at the read head, the
|
|
2257
|
+
// audio run begins AHEAD of the viewer, and every request they then make
|
|
2258
|
+
// is behind a run that only moves forward — field 2026-08-15, placed at
|
|
2259
|
+
// #16 while the player asked for #10, and the audio arrived only after
|
|
2260
|
+
// the encoder was dragged back.
|
|
2261
|
+
//
|
|
2262
|
+
// The distance is measured, not assumed: the browser reports how many
|
|
2263
|
+
// seconds it holds ahead of the picture with every link report, so the
|
|
2264
|
+
// playhead is one subtraction away. A stale report is no use — a viewer
|
|
2265
|
+
// who seeked since then is somewhere else entirely — so an old one is
|
|
2266
|
+
// ignored and the whole look-ahead is subtracted instead, which cannot
|
|
2267
|
+
// leave the run ahead of them.
|
|
2268
|
+
startPositionSeconds: this.#host.audioStartSecondsFor({
|
|
2269
|
+
family: this.#host.outputs.familyOf(base),
|
|
2270
|
+
openedAtSeconds: this.#host.encodeRuns.progressOf(base)?.startPositionSeconds,
|
|
2271
|
+
segmentSeconds: this.#host.segmentDurationSec
|
|
2272
|
+
}),
|
|
2273
|
+
segmentFormatId: base.segmentFormat.id,
|
|
2274
|
+
// Cut where the picture is cut. Two streams meant to be played together
|
|
2275
|
+
// have to be divided at the same times, and the grid is the base's — the
|
|
2276
|
+
// table as it stands now, corrections included. A base on the uniform
|
|
2277
|
+
// grid passes nothing: the rendition computes the same even grid from the
|
|
2278
|
+
// same duration.
|
|
2279
|
+
inheritedGrid: base.timeline.cutGrid === "keyframe"
|
|
2280
|
+
? {
|
|
2281
|
+
boundaries: base.timeline.boundaries,
|
|
2282
|
+
published: base.timeline.published
|
|
2283
|
+
}
|
|
2284
|
+
: null
|
|
2285
|
+
});
|
|
2286
|
+
waitOutcome = rendition ? "opened" : "unavailable";
|
|
2287
|
+
return rendition ?? null;
|
|
2288
|
+
} finally {
|
|
2289
|
+
const waitEndedAt = performance.now();
|
|
2290
|
+
this.#host.observeWait?.(base.file.sourceKey, "process", { ...waitFields, phase: "end",
|
|
2291
|
+
at: waitEndedAt, startedAt: waitStartedAt, endedAt: waitEndedAt,
|
|
2292
|
+
durationMs: waitEndedAt - waitStartedAt, outcome: waitOutcome });
|
|
2293
|
+
}
|
|
2276
2294
|
}
|
|
2277
2295
|
|
|
2278
2296
|
/**
|
|
@@ -394,6 +394,7 @@ export function wireOutputs({
|
|
|
394
394
|
worstSupplyWaitSec: parts.hostLoad.supplyFor(output.file)?.worstWaitSec
|
|
395
395
|
})?.seconds ?? null;
|
|
396
396
|
parts.renditions = new Renditions({
|
|
397
|
+
observeWait,
|
|
397
398
|
// Whether this proxy re-encodes at all: a soundtrack with no stated rate is
|
|
398
399
|
// re-encoded where it may be, and copied where it may not.
|
|
399
400
|
get transcodeEnabled() { return parts.enabled; },
|