@torrent-tv/proxy 2.95.24 → 2.95.25

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.95.24",
3
+ "version": "2.95.25",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -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) admittedInput.release();
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;