@torrent-tv/proxy 2.95.24 → 2.95.26
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
|
@@ -1009,7 +1009,16 @@ export class EncodeRuns {
|
|
|
1009
1009
|
onSpeedMeasured: () => this.#host.noteRunSpeedMeasured?.(session, run),
|
|
1010
1010
|
onEnded: (ended) => {
|
|
1011
1011
|
this.#runsByInputToken.delete(inputToken);
|
|
1012
|
-
if (admittedInput.original)
|
|
1012
|
+
if (admittedInput.original) {
|
|
1013
|
+
const reads = admittedInput.reads?.();
|
|
1014
|
+
if (reads) {
|
|
1015
|
+
const since = (at) => at ? `${at - run.startedAt}ms` : "never";
|
|
1016
|
+
this.#host.logger.info(`encode input of run #${run.from}..#${run.to} on ${session.outputKey}: ` +
|
|
1017
|
+
`${reads.count} read(s), ${reads.bytes} bytes, first at ${since(reads.firstAt)}, last at ${since(reads.lastAt)}, ` +
|
|
1018
|
+
`ended at ${Date.now() - run.startedAt}ms`);
|
|
1019
|
+
}
|
|
1020
|
+
admittedInput.release();
|
|
1021
|
+
}
|
|
1013
1022
|
this.noteRunEnded(session, run, ended);
|
|
1014
1023
|
}
|
|
1015
1024
|
});
|
|
@@ -27,6 +27,10 @@ export async function admitOriginalInput({ sources, reserve, readRanges }) {
|
|
|
27
27
|
}
|
|
28
28
|
let released = false;
|
|
29
29
|
retained = true;
|
|
30
|
+
// What FFmpeg asked of this input, for the run's own account of where its
|
|
31
|
+
// time went: field 2026-10-08, a run took 6-9 s for a piece FFmpeg makes in
|
|
32
|
+
// 1.6 s from a file, and nothing said whether it was waiting on its input.
|
|
33
|
+
const reads = { count: 0, bytes: 0, firstAt: 0, lastAt: 0 };
|
|
30
34
|
return {
|
|
31
35
|
kind: "result", original: true, sources, bytes, fingerprint: hash.digest("hex"),
|
|
32
36
|
tracks: sources.flatMap(source => (source.input.selections ?? []).map(selection => ({ track: selection.track,
|
|
@@ -43,9 +47,15 @@ export async function admitOriginalInput({ sources, reserve, readRanges }) {
|
|
|
43
47
|
const position = ranges.findIndex(([from, to]) => from <= start && (partial ? start : stop) <= to);
|
|
44
48
|
if (position < 0) return null;
|
|
45
49
|
stop = Math.min(stop, ranges[position][1]);
|
|
50
|
+
const now = Date.now();
|
|
51
|
+
reads.count += 1;
|
|
52
|
+
reads.bytes += stop - start + 1;
|
|
53
|
+
reads.firstAt ||= now;
|
|
54
|
+
reads.lastAt = now;
|
|
46
55
|
return { length: fileLength, end: stop, bytes: entry.buffers[position].subarray(start - ranges[position][0], stop - ranges[position][0] + 1) };
|
|
47
56
|
},
|
|
48
57
|
lengthOf: fileIndex => held.get(fileIndex)?.source.input.fileLength ?? null,
|
|
58
|
+
reads: () => ({ ...reads }),
|
|
49
59
|
release() {
|
|
50
60
|
if (released) return;
|
|
51
61
|
released = true;
|
|
@@ -1489,6 +1489,13 @@ export class TorrentPool {
|
|
|
1489
1489
|
torrent.on("download-request-cancel-failed", ({ piece, offset, length, error }) => {
|
|
1490
1490
|
logger.warn(`download request=${torrent.infoHash ?? "unknown"}:${piece}:${offset} cancel bytes=${length} failed: ${error}`);
|
|
1491
1491
|
});
|
|
1492
|
+
// WHEN each piece arrived. The requests above say what was asked for; this
|
|
1493
|
+
// says what came and in which order, which is what decides how far an
|
|
1494
|
+
// encoder reading the file can go before it meets a piece still missing
|
|
1495
|
+
// (torrent-tv/meta#151). One short line per piece: a 2.3 GB film is 563.
|
|
1496
|
+
torrent.on("verified", (piece) => {
|
|
1497
|
+
logger.info(`download ${label()} verified piece=${piece}`);
|
|
1498
|
+
});
|
|
1492
1499
|
|
|
1493
1500
|
// The first connected peer, said once, because the wait for it can BE the
|
|
1494
1501
|
// whole cold start and nothing else measures it.
|