@torrent-tv/proxy 2.89.13 → 2.89.14

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.89.14
2
+
3
+ - **Fix**: A failed run counts only the source's own streams. The planner probes with an output, so ffmpeg's banner goes on to list the streams it maps and writes, and those were counted too: a file with one picture, one soundtrack, one subtitle and one font read as `2 video, 2 audio, 1 subtitle, 3 other` in the field — enough to make a second soundtrack look present when it is not.
4
+
1
5
  ## 2.89.13
2
6
 
3
7
  - **Fix**: The proxy no longer stops answering everybody when one output is priced near zero. Asking how many encoders an output may run counted them one at a time until the machine was full, so the number of steps grew as the price shrank. On the stand on 2026-10-04 a soundtrack priced at 5.4e-14 s of machine per second of film held the main thread in that count for minutes, past 3.3 billion steps: no data channel was served, `/healthz` did not answer, and every viewer stopped. The count is now found by doubling and halving, in at most a few hundred steps whatever the price. The price itself is wrong and is not corrected here.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.89.13",
3
+ "version": "2.89.14",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -141,7 +141,13 @@ export function parseFfmpegStreamCounts(stderrText) {
141
141
  if (typeof stderrText !== "string" || stderrText.length === 0) {
142
142
  return null;
143
143
  }
144
- const lines = stderrText.match(/^\s*Stream #\d+:\d+.*$/gim);
144
+ // The source's streams only. A probe that writes somewhere — the planner's
145
+ // `-f null -` does — goes on to print `Stream mapping:` and `Output #0` with
146
+ // stream lines of their own, and counting those doubled the picture and the
147
+ // sound (field 2026-10-04: one soundtrack read as two).
148
+ const end = stderrText.search(/^(?:Stream mapping:|Output #\d+)/m);
149
+ const inputText = end >= 0 ? stderrText.slice(0, end) : stderrText;
150
+ const lines = inputText.match(/^\s*Stream #\d+:\d+.*$/gim);
145
151
  if (!lines || lines.length === 0) {
146
152
  return null;
147
153
  }
@@ -76,3 +76,26 @@ test("a stream carrying metadata in brackets is still read", () => {
76
76
  `);
77
77
  assert.deepEqual(counts, { video: 1, audio: 1, subtitle: 0, other: 0 });
78
78
  });
79
+
80
+ test("only the input's streams are counted, not the output ffmpeg describes after them", () => {
81
+ // The planner probes with `-i <file> -t 0.1 -f null -`, so the banner goes on
82
+ // to describe what it maps and the null output it writes. Counted whole, this
83
+ // field file (one picture, one soundtrack, one subtitle, one font) read as
84
+ // "2 video, 2 audio, 1 subtitle, 3 other" on 2026-10-04 — which would make a
85
+ // second soundtrack look present when it is not.
86
+ const banner = `
87
+ Input #0, matroska,webm, from 'http://127.0.0.1:9090/stream?sourceKey=torrent%3A84acab5f&fileIndex=35':
88
+ Duration: 00:23:41.44, start: 0.000000, bitrate: 3195 kb/s
89
+ Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.81 fps, 23.81 tbr, 1k tbn (default)
90
+ Stream #0:1(jpn): Audio: aac (LC), 44100 Hz, stereo, fltp (default)
91
+ Stream #0:2(eng): Subtitle: ass (ssa) (default)
92
+ Stream #0:3: Attachment: ttf
93
+ Stream mapping:
94
+ Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
95
+ Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
96
+ Output #0, null, to 'pipe:':
97
+ Stream #0:0: Video: wrapped_avframe, yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 23.81 fps, 23.81 tbn (default)
98
+ Stream #0:1(jpn): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
99
+ `;
100
+ assert.deepEqual(parseFfmpegStreamCounts(banner), { video: 1, audio: 1, subtitle: 1, other: 1 });
101
+ });