@torrent-tv/proxy 2.84.0 → 2.85.0
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 +13 -0
- package/package.json +1 -1
- package/routes/api/link-probe/get.js +51 -0
- package/routes/api/transcode-sessions/net-report/post.js +84 -64
- package/routes/transcode/session-file/get.js +268 -240
- package/server.js +3 -0
- package/services/data-channel-handler.js +6 -1
- package/services/delivery-probe.js +842 -828
- package/services/hls-session-manager.js +14 -32
- package/services/priority/PriorityOrchestrator.js +11 -7
- package/services/viewer/Viewer.js +122 -53
- package/services/viewer/report-intake.js +63 -0
- package/test/link-probe.test.js +56 -0
- package/test/plan-is-steady.test.js +225 -223
- package/test/priority-map-emptied.test.js +0 -2
- package/test/viewer-states.test.js +151 -0
- package/test/viewer.test.js +24 -3
package/test/viewer.test.js
CHANGED
|
@@ -49,19 +49,40 @@ test("position is one fact with one writer, and a function of time", () => {
|
|
|
49
49
|
const viewer = new Viewer("someone");
|
|
50
50
|
assert.equal(viewer.positionSeconds(), null);
|
|
51
51
|
|
|
52
|
-
viewer.
|
|
53
|
-
viewer.playing = false;
|
|
52
|
+
viewer.report({ bufferedAheadSec: 60, positionSeconds: 40, playing: false }, 1_000_000);
|
|
54
53
|
assert.equal(viewer.positionSeconds(1_000_000), 40);
|
|
55
54
|
assert.equal(viewer.positionSeconds(1_060_000), 40, "a stopped picture covers no film");
|
|
56
55
|
|
|
57
|
-
viewer.playing
|
|
56
|
+
viewer.report({ bufferedAheadSec: 60, positionSeconds: 40, playing: true }, 1_000_000);
|
|
58
57
|
assert.equal(viewer.positionSeconds(1_010_000), 50, "a playing one covers a second a second");
|
|
58
|
+
assert.equal(
|
|
59
|
+
viewer.positionSeconds(1_600_000),
|
|
60
|
+
100,
|
|
61
|
+
"and no further than the film they said they held"
|
|
62
|
+
);
|
|
59
63
|
|
|
60
64
|
// A seek is the same statement, and there is no second field for it to win
|
|
61
65
|
// against: two writers taking turns on one reading is what made the priority
|
|
62
66
|
// map jump backwards several times a second in the field on 2026-09-13.
|
|
63
67
|
viewer.moveTo(900, 1_010_000);
|
|
64
68
|
assert.equal(viewer.positionSeconds(1_010_000), 900);
|
|
69
|
+
assert.equal(
|
|
70
|
+
viewer.positionSeconds(1_070_000),
|
|
71
|
+
900,
|
|
72
|
+
"and a seek carries no cushion from where it left, so nothing is extrapolated"
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("a viewer who has stated nothing has a position and does not drift from it", () => {
|
|
77
|
+
const viewer = new Viewer("someone");
|
|
78
|
+
viewer.moveTo(0, 1_000_000);
|
|
79
|
+
|
|
80
|
+
// The whole of the fault of 2026-09-14: `playing` used to start true, and a
|
|
81
|
+
// page that had measured nothing was never allowed to say otherwise, so a
|
|
82
|
+
// hidden tab's viewer was carried 146 seconds into a film they had not begun.
|
|
83
|
+
assert.equal(viewer.playing, false);
|
|
84
|
+
assert.equal(viewer.waiting, true, "a viewer who has just arrived is waiting on us");
|
|
85
|
+
assert.equal(viewer.positionSeconds(1_146_000), 0);
|
|
65
86
|
});
|
|
66
87
|
|
|
67
88
|
test("asking for a viewer twice is the same viewer", () => {
|