@torrent-tv/proxy 2.66.0 → 2.66.1
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 +4 -0
- package/package.json +1 -1
- package/services/hls-session-manager.js +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2.64.10
|
|
2
|
+
|
|
3
|
+
- **Fix**: When a re-encode cannot keep up and nothing LOWER is on offer, the budget asks for the COPY instead of leaving the viewer where they are. "Cheaper" in that rule meant "fewer pixels", and it had no way to express that a copied rung costs no encoder at all, whatever its size — so it looked down, found every rung below refused, and gave up. Field 2026-08-31 and it cost the whole film: a 444x240 ultrafast encode ran at 0.43-0.94x for fifty minutes while the source's own 1038p sat on offer beside it, copied and free; the line `nothing lower is on offer; leaving the picture alone` printed fifty times and the picture stood still 161 times for 940 seconds. On a copied source the way out is up, and it is both the fastest thing the host can serve and the best picture it has (`research/session-2026-08-31-seeks-and-the-copy.md`).
|
|
4
|
+
|
|
1
5
|
## 2.66.0
|
|
2
6
|
|
|
3
7
|
- **New**: A soundtrack that ships beside the picture is fetched WHOLE once the swarm has capacity to spare, so a later switch to it does not wait. It is a twentieth of the picture — 30 MB against 566 MB on the field torrent — and having it on disk is the difference between an instant switch and one that pays for its own first pieces. The moment it starts is not a guess about the swarm: it is when the encoder is already as far ahead of the viewer as `--lookahead` lets it get, which is the cushion figure the session already measures and prints. Once per file, and only for a soundtrack in a file of its own.
|
package/package.json
CHANGED
|
@@ -4440,6 +4440,27 @@ export class HlsSessionManager {
|
|
|
4440
4440
|
const next = this.#splicableHeights(base)
|
|
4441
4441
|
.find((height) => height < current && offered.includes(height));
|
|
4442
4442
|
if (next === undefined) {
|
|
4443
|
+
// Nothing lower — but "lower" is not the same question as "cheaper", and
|
|
4444
|
+
// on a source that is COPIED the answer is above, not below. A copied
|
|
4445
|
+
// rung costs no encoder at all, whatever its size, so when a re-encode
|
|
4446
|
+
// cannot keep up it is both the fastest thing this host can serve AND the
|
|
4447
|
+
// best picture it has.
|
|
4448
|
+
//
|
|
4449
|
+
// Field 2026-08-31, and it cost the viewer the whole film: an ultrafast
|
|
4450
|
+
// 444x240 encode ran at 0.43-0.94x for fifty minutes while the source's
|
|
4451
|
+
// own 1038p sat on offer beside it, copied and free. This line printed
|
|
4452
|
+
// fifty times — "nothing lower is on offer; leaving the picture alone" —
|
|
4453
|
+
// and the picture stood still 161 times for 940 seconds. The rescue was
|
|
4454
|
+
// on the screen the whole time and the rule could only look down.
|
|
4455
|
+
const copied = this.#copiedHeightOf(base);
|
|
4456
|
+
if (copied > 0 && copied !== current && offered.includes(copied)) {
|
|
4457
|
+
logger.info(
|
|
4458
|
+
`[budget] transcode ${session.id} ${reasonText} at ${current}p and nothing lower is on offer, ` +
|
|
4459
|
+
`but ${copied}p is COPIED on this file — no encoder at all, and a better picture. ` +
|
|
4460
|
+
`Asking for it instead of leaving the viewer on an encode that cannot keep up`
|
|
4461
|
+
);
|
|
4462
|
+
return this.#askQualityHeight(base, copied, reasonText);
|
|
4463
|
+
}
|
|
4443
4464
|
logger.info(
|
|
4444
4465
|
`[budget] transcode ${session.id} ${reasonText} at ${current}p, but nothing lower is on offer ` +
|
|
4445
4466
|
`for "${session.fileName}"; leaving the picture alone`
|
|
@@ -4449,6 +4470,25 @@ export class HlsSessionManager {
|
|
|
4449
4470
|
return this.#askQualityHeight(base, next, reasonText);
|
|
4450
4471
|
}
|
|
4451
4472
|
|
|
4473
|
+
/**
|
|
4474
|
+
* The height this family serves by COPY, or zero when every rung is encoded.
|
|
4475
|
+
*
|
|
4476
|
+
* The one rung whose cost does not depend on the machine: the source's own
|
|
4477
|
+
* height, on a base whose video is not re-encoded. `offeredHeights` never
|
|
4478
|
+
* withdraws it for that reason, so it is always available as somewhere to
|
|
4479
|
+
* return to — which is exactly what {@link HlsSessionManager##askLowerHeight}
|
|
4480
|
+
* had no way to say.
|
|
4481
|
+
*
|
|
4482
|
+
* @param {HlsSession} base
|
|
4483
|
+
* @returns {number}
|
|
4484
|
+
*/
|
|
4485
|
+
#copiedHeightOf(base) {
|
|
4486
|
+
if (!base || base.transcodeVideo === true) {
|
|
4487
|
+
return 0;
|
|
4488
|
+
}
|
|
4489
|
+
return Math.round(Number(base.sourceHeight) || 0);
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4452
4492
|
/**
|
|
4453
4493
|
* Record a request to the viewer's player to move to another variant.
|
|
4454
4494
|
*
|