@torrent-tv/proxy 2.93.2 → 2.93.3

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.93.2",
3
+ "version": "2.93.3",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -27,6 +27,14 @@ export class EncodeInputs {
27
27
 
28
28
  held() { return this.#held; }
29
29
  wanted() { return this.#held + [...this.#wanted.values()].reduce((sum, bytes) => sum + bytes, 0); }
30
+ required() {
31
+ let bytes = this.#held;
32
+ for (const [key, wanted] of this.#wanted) {
33
+ const request = this.#requests.get(key);
34
+ if (request && this.#urgent(request.output, request.from)) bytes += wanted;
35
+ }
36
+ return bytes;
37
+ }
30
38
  allow(bytes) {
31
39
  const changed = this.#allowed !== Math.max(0, bytes);
32
40
  this.#allowed = Math.max(0, bytes);
@@ -370,7 +370,11 @@ export class EncodeRuns {
370
370
  if (!whole) {
371
371
  this.#host.logger.warn(
372
372
  `encode: not publishing piece ${index} of ${address.slice(0, 60)}: ` +
373
- (reason ?? (throughSeconds === null ? "it holds no playable media" : `produced through ${throughSeconds}s, cut ${cut}s`))
373
+ (reason ?? (throughSeconds === null ? "it holds no playable media" : `produced through ${throughSeconds}s, cut ${cut}s`)) +
374
+ (interval ? ` expected=${interval.from}..${interval.to} tracks=${JSON.stringify(mediaRanges.tracks.map(track => ({
375
+ kind: track.kind, timescale: track.timescale, frame: track.productionFrame,
376
+ first: track.ranges[0], last: track.ranges.at(-1), count: track.ranges.length })),
377
+ (_key, value) => typeof value === "bigint" ? String(value) : value)}` : "")
374
378
  );
375
379
  return false;
376
380
  }
@@ -90,7 +90,7 @@ export function wireMachineBudget({
90
90
 
91
91
  budget.defineResource({ name: "memory", readFree: () => availableMemoryBytes() });
92
92
  if (encodeInputs) budget.register({ name: "admitted encode inputs", resource: "memory",
93
- held: () => encodeInputs.held(), wanted: () => encodeInputs.wanted(), required: () => encodeInputs.held(), allow: bytes => encodeInputs.allow(bytes) });
93
+ held: () => encodeInputs.held(), wanted: () => encodeInputs.wanted(), required: () => encodeInputs.required(), allow: bytes => encodeInputs.allow(bytes) });
94
94
  if (indexMemory) budget.register({ name: "media metadata", resource: "memory",
95
95
  held: () => indexMemory.held(), wanted: () => indexMemory.wanted(), required: () => indexMemory.required(), allow: bytes => indexMemory.allow(bytes) });
96
96