@torrent-tv/proxy 2.105.1 → 2.105.2
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
|
@@ -575,6 +575,7 @@ export class ViewerRequests {
|
|
|
575
575
|
// still answered by the output it was made against — see the two deadlines
|
|
576
576
|
// in `Assignments.js`.
|
|
577
577
|
viewer.assignments.statedGeneration(generation);
|
|
578
|
+
this.#beginSeekWait(named, consumerId, generation);
|
|
578
579
|
this.#host.outputs.touch(named);
|
|
579
580
|
// EVERY REQUEST THIS VIEWER HAS OUTSTANDING WAS MADE FOR WHERE THEY WERE,
|
|
580
581
|
// and hls.js keeps one fragment load outstanding per track: a request held
|
|
@@ -601,6 +602,40 @@ export class ViewerRequests {
|
|
|
601
602
|
return true;
|
|
602
603
|
}
|
|
603
604
|
|
|
605
|
+
#beginSeekWait(output, consumerId, generation) {
|
|
606
|
+
const file = output?.file;
|
|
607
|
+
if (!Number.isSafeInteger(generation) || !file || typeof file.sourceKey !== "string" ||
|
|
608
|
+
!Number.isSafeInteger(file.fileIndex) || file.fileIndex < 0) return;
|
|
609
|
+
const waitId = `${file.sourceKey}:${file.fileIndex}:${generation}`;
|
|
610
|
+
const key = `${consumerId}:${waitId}`;
|
|
611
|
+
const fileName = file.relativePath ?? file.name ?? "";
|
|
612
|
+
const extension = typeof fileName === "string" ? fileName.split(".").at(-1)?.toLowerCase() ?? "" : "";
|
|
613
|
+
const viewer = this.#host.viewers.get(consumerId);
|
|
614
|
+
const link = linkMeasurementOf(viewer);
|
|
615
|
+
const features = {
|
|
616
|
+
extension,
|
|
617
|
+
fileLength: Number.isFinite(file.length) && file.length > 0 ? file.length : null,
|
|
618
|
+
downloadSpeed: null,
|
|
619
|
+
linkMbps: link.mbps,
|
|
620
|
+
linkSampleAgeMs: link.ageMs,
|
|
621
|
+
preparedOutputBytes: this.#preparedOutputBytes(file.sourceKey, file.fileIndex),
|
|
622
|
+
fileAvailable: null,
|
|
623
|
+
headerRemaining: null,
|
|
624
|
+
peers: null,
|
|
625
|
+
videoOperation: null,
|
|
626
|
+
audioOperation: null,
|
|
627
|
+
videoSpeedX: null,
|
|
628
|
+
audioSpeedX: null
|
|
629
|
+
};
|
|
630
|
+
// A seek is a new waiting action even when a caller repeats the same
|
|
631
|
+
// generation. Start its clock at the explicit seek request, before the
|
|
632
|
+
// next readiness poll can return the first current-work estimate.
|
|
633
|
+
this.#earlyWaits.delete(key);
|
|
634
|
+
const context = this.#setEarlyWait({ consumerId, generation, sourceKey: file.sourceKey,
|
|
635
|
+
fileIndex: file.fileIndex, waitId, features, revision: 0, current: null, waitElapsedMs: 0 });
|
|
636
|
+
this.#recordEarlyWaitSnapshot(context, features);
|
|
637
|
+
}
|
|
638
|
+
|
|
604
639
|
/**
|
|
605
640
|
* Whether this viewer still takes a request made in the generation it states.
|
|
606
641
|
*
|