@torrent-tv/proxy 2.80.10 → 2.80.12

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.
@@ -1,83 +0,0 @@
1
- /**
2
- * @file What the decode measurement must never get wrong.
3
- *
4
- * The quality menu is predicted from these readings, so a reading that is
5
- * merely PRECISE is worth nothing — it has to be ordered the way decoding is.
6
- * Under `-stream_loop -1` it was not: the loop restart costs 0.03 s on a 480p
7
- * clip and 0.12 s on a 1080p one (the decoder tearing down and re-allocating
8
- * its frame buffers), a five-second clip at 55x restarts eleven times a second,
9
- * and the resulting bias depends on the clip's own resolution and on how fast
10
- * the host is. On a fast desktop, 2026-08-20, that made 1080p read cheaper than
11
- * 720p — which is not a thing a decoder does, and the fit refused to solve.
12
- *
13
- * These tests state the orderings instead of the numbers: the numbers are
14
- * properties of whatever machine runs them.
15
- */
16
-
17
- import test from "node:test";
18
- import assert from "node:assert/strict";
19
- import path from "node:path";
20
- import { fileURLToPath } from "node:url";
21
- import ffmpegStatic from "ffmpeg-static";
22
- import { measureDecodeSlope } from "../services/hwaccel.js";
23
-
24
- const CLIPS = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "assets", "calibration");
25
- const clip = (name) => path.join(CLIPS, name);
26
-
27
- test("a bigger picture costs more than a smaller one of the same bitrate", async () => {
28
- const big = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-1080-hi.mp4"));
29
- const small = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-480-hi.mp4"));
30
-
31
- assert.ok(big, "the 1080p clip was measured");
32
- assert.ok(small, "the 480p clip was measured");
33
- assert.ok(
34
- small.speed > big.speed,
35
- `480p decoded at ${small.speed.toFixed(1)}x and 1080p at ${big.speed.toFixed(1)}x — ` +
36
- `an ordering no decoder produces, which is what the loop used to invert`
37
- );
38
- });
39
-
40
- test("a thicker stream costs more than a thin one of the same size", async () => {
41
- const thick = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-480-hi.mp4"));
42
- const thin = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-480-lo.mp4"));
43
-
44
- assert.ok(thick && thin);
45
- assert.ok(
46
- thin.speed > thick.speed,
47
- `the same picture at ${thin.megabitsPerSecond.toFixed(2)} Mbit/s decoded at ${thin.speed.toFixed(1)}x ` +
48
- `and at ${thick.megabitsPerSecond.toFixed(2)} Mbit/s at ${thick.speed.toFixed(1)}x`
49
- );
50
- });
51
-
52
- test("HEVC costs more than H.264 for the same picture on the same machine", async () => {
53
- const h264 = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-480-lo.mp4"), "h264");
54
- const hevc = await measureDecodeSlope(ffmpegStatic, clip("cal-hevc-480-lo.mp4"), "hevc");
55
-
56
- assert.ok(h264 && hevc, "both families are lifted out of their containers correctly");
57
- assert.ok(
58
- h264.speed > hevc.speed,
59
- `H.264 ${h264.speed.toFixed(1)}x against HEVC ${hevc.speed.toFixed(1)}x — the reason the model ` +
60
- `is fitted per codec family at all`
61
- );
62
- });
63
-
64
- test("the clip's own characteristics come back with the reading", async () => {
65
- const measured = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-1080-hi.mp4"));
66
-
67
- assert.ok(measured);
68
- // Read from the container rather than declared anywhere, so replacing a clip
69
- // cannot silently invalidate the fit that rests on it.
70
- assert.ok(measured.megapixelsPerSecond > 40 && measured.megapixelsPerSecond < 60);
71
- assert.ok(measured.megabitsPerSecond > 5 && measured.megabitsPerSecond < 15);
72
- assert.ok(measured.windowSec >= 0.5, "the slope is taken over a window wide enough to divide by");
73
- });
74
-
75
- test("a reading carries what the pipe was actually fed, for item 4(d2)'s sanity check", async () => {
76
- const measured = await measureDecodeSlope(ffmpegStatic, clip("cal-h264-480-lo.mp4"));
77
-
78
- assert.ok(measured);
79
- assert.ok(
80
- measured.pipeThroughputMBps > 0,
81
- "the write path pushed a nonzero amount of the clip through, or nothing was measured at all"
82
- );
83
- });