@torrent-tv/proxy 2.93.1 → 2.93.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
|
@@ -982,7 +982,8 @@ export function wireOutputs({
|
|
|
982
982
|
index >= window.from && index <= window.to && window.withinSeconds === 0),
|
|
983
983
|
changed: (output, result) => {
|
|
984
984
|
if (result.kind === "terminal") {
|
|
985
|
-
logger.warn(`encode input output=${output.outputKey} terminal=${result.reason}: ${result.message ?? ""}`
|
|
985
|
+
logger.warn(`encode input output=${output.outputKey} terminal=${result.reason}: ${result.message ?? ""}` +
|
|
986
|
+
(Number.isFinite(result.bytes) ? ` bytes=${result.bytes} capacity=${result.capacity}` : ""));
|
|
986
987
|
parts.serving.invalidateWaits(output);
|
|
987
988
|
}
|
|
988
989
|
parts.encodeRuns.planEncodersSoon();
|
|
@@ -27,7 +27,7 @@ export class DownloadMaps {
|
|
|
27
27
|
if (!current || Object.keys(current).some(key => key !== "from" && key !== "to" && !Object.is(zone[key], key === "deadlineAt" ? deadlineAt : current[key]))) changed = true;
|
|
28
28
|
return current ? [{ ...zone, ...current, from: zone.from, to: zone.to, deadlineAt }] : [];
|
|
29
29
|
});
|
|
30
|
-
file
|
|
30
|
+
this.#setZones(file, retained);
|
|
31
31
|
for (const [statement, metadata] of file.metadata) {
|
|
32
32
|
if (metadata.interval && !this.wantsInterval(sourceKey, fileIndex, metadata.interval)) {
|
|
33
33
|
file.metadata.delete(statement);
|
|
@@ -47,7 +47,7 @@ export class DownloadMaps {
|
|
|
47
47
|
const resolved = await this.#resolvePlayback({ sourceKey, fileIndex, durationSeconds, zones: file.sourceZones,
|
|
48
48
|
isCurrent: () => this.#files.get(`${sourceKey}:${fileIndex}`) === file && revision === file.revision });
|
|
49
49
|
if (revision !== file.revision) return;
|
|
50
|
-
file
|
|
50
|
+
this.#setZones(file, resolved);
|
|
51
51
|
return this.#emit(file);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -87,10 +87,10 @@ export class DownloadMaps {
|
|
|
87
87
|
const sources = [];
|
|
88
88
|
for (const file of this.#files.values()) {
|
|
89
89
|
if (file.sourceKey !== sourceKey) continue;
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
90
|
+
const ranges = file.inputs.get(outputKey)?.get(index);
|
|
91
|
+
if (!ranges?.length) continue;
|
|
92
92
|
sources.push({ sourceId: `${sourceKey}:${file.fileIndex}`,
|
|
93
|
-
ranges
|
|
93
|
+
ranges });
|
|
94
94
|
}
|
|
95
95
|
return sources.length ? sources : null;
|
|
96
96
|
}
|
|
@@ -130,7 +130,7 @@ export class DownloadMaps {
|
|
|
130
130
|
|
|
131
131
|
forget(sourceKey, fileIndex, { keepPreparation = false } = {}) {
|
|
132
132
|
const file = this.#file(sourceKey, fileIndex);
|
|
133
|
-
file
|
|
133
|
+
this.#setZones(file, []);
|
|
134
134
|
file.sourceZones = [];
|
|
135
135
|
if (!keepPreparation) file.nativeZones = [];
|
|
136
136
|
file.revision++;
|
|
@@ -158,12 +158,25 @@ export class DownloadMaps {
|
|
|
158
158
|
const key = `${sourceKey}:${fileIndex}`;
|
|
159
159
|
let file = this.#files.get(key);
|
|
160
160
|
if (!file) {
|
|
161
|
-
file = { sourceKey, fileIndex, durationSeconds: 0, zones: [], nativeZones: [], sourceZones: [], revision: 0, epoch: ++this.#nextEpoch, metadata: new Map(), pending: Promise.resolve() };
|
|
161
|
+
file = { sourceKey, fileIndex, durationSeconds: 0, zones: [], inputs: new Map(), nativeZones: [], sourceZones: [], revision: 0, epoch: ++this.#nextEpoch, metadata: new Map(), pending: Promise.resolve() };
|
|
162
162
|
this.#files.set(key, file);
|
|
163
163
|
}
|
|
164
164
|
return file;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
#setZones(file, zones) {
|
|
168
|
+
file.zones = zones;
|
|
169
|
+
file.inputs = new Map();
|
|
170
|
+
for (const zone of zones) {
|
|
171
|
+
if (typeof zone.outputKey !== "string" || !Number.isSafeInteger(zone.index)) continue;
|
|
172
|
+
let output = file.inputs.get(zone.outputKey);
|
|
173
|
+
if (!output) file.inputs.set(zone.outputKey, output = new Map());
|
|
174
|
+
let ranges = output.get(zone.index);
|
|
175
|
+
if (!ranges) output.set(zone.index, ranges = []);
|
|
176
|
+
ranges.push({ start: zone.byteStart, end: zone.byteEnd + 1 });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
167
180
|
#emit(file) {
|
|
168
181
|
const zones = [...file.zones, ...file.nativeZones];
|
|
169
182
|
for (const { ranges, requestId, priority, urgent, deadlineAt, order } of file.metadata.values()) {
|