@torrent-tv/proxy 2.80.9 → 2.80.11

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +1685 -1666
  2. package/package.json +1 -1
  3. package/services/data-channel-handler.js +2 -4
  4. package/services/encode/EncodePlan.js +0 -3
  5. package/services/encode/EncodeRun.js +14 -0
  6. package/services/encode/run-command.js +729 -707
  7. package/services/hls-session-manager.js +10168 -10494
  8. package/services/hwaccel.js +2 -2
  9. package/services/orchestrators/EncodeOrchestrator.js +4 -4
  10. package/services/output/LiveOutputs.js +49 -0
  11. package/services/priority/PriorityOrchestrator.js +278 -174
  12. package/services/quality/EncodeCost.js +555 -555
  13. package/test/auto-quality-step.test.js +514 -507
  14. package/test/contention.test.js +1 -1
  15. package/test/decode-cost-fit.test.js +57 -0
  16. package/test/decode-cost.test.js +13 -36
  17. package/test/encode-orchestrator.test.js +1 -2
  18. package/test/encode-plan-viewers.test.js +18 -19
  19. package/test/encode-plan.test.js +539 -539
  20. package/test/held-request-width.test.js +155 -154
  21. package/test/helpers/encode-run.js +136 -128
  22. package/test/keyframe-table-budget.test.js +7 -1
  23. package/test/one-authority.test.js +220 -105
  24. package/test/orchestrator-wired.test.js +16 -11
  25. package/test/piece-store-slow-disk.test.js +32 -2
  26. package/test/priority-map-per-output.test.js +211 -0
  27. package/test/produced-copy-choice.test.js +358 -327
  28. package/test/quality-variants.test.js +1222 -1209
  29. package/test/segment-serve-wiring.test.js +76 -20
  30. package/test/stale-request-after-seek.test.js +51 -77
  31. package/test/tracks-begin-together.test.js +195 -153
  32. package/test/tunnel-renewal.test.js +34 -5
  33. package/test/two-viewers-one-picture.test.js +374 -347
  34. package/test/viewer-outputs.test.js +18 -14
  35. package/test/behind-head-repair.test.js +0 -261
  36. package/test/decode-measurement.test.js +0 -83
  37. /package/services/{contention.js → encode/contention.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.80.9",
3
+ "version": "2.80.11",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "publishConfig": {
@@ -274,7 +274,7 @@ function makeSendQueueWatcher({ log, getTransportSnapshot, witness, usrsctpState
274
274
  // would be cleared a second after the wedged channel set it and the line
275
275
  // would print for every second of a 54-minute episode.
276
276
  let wedgeSaid = false;
277
- let lastStuckLogAt = 0;
277
+ let lastStuckLogAt = 0;
278
278
  let connection = connections.get(sessionId);
279
279
  if (!connection) {
280
280
  connection = {
@@ -481,7 +481,7 @@ function makeSendQueueWatcher({ log, getTransportSnapshot, witness, usrsctpState
481
481
  `received=${snapshot.bytesReceived}${recvDelta === null ? "" : ` (+${recvDelta})`} ` +
482
482
  `rtt=${snapshot.rtt}ms pc=${snapshot.state} ice=${snapshot.iceState} pair=${snapshot.pair}`
483
483
  );
484
- }
484
+ }
485
485
  // Roadmap item 11: ask for the packet-level truth the moment the wedge is
486
486
  // CERTAIN, not after a chosen delay. The three facts below are not
487
487
  // ambiguous together — the queue has not fallen, the accepted-byte
@@ -1305,5 +1305,3 @@ const SEND_QUEUE_STUCK_MS = 5_000;
1305
1305
  const DC_BUFFER_HIGH_WATER = 8 * 1024 * 1024;
1306
1306
  /** Resume sending once the channel buffer drains to this many bytes. */
1307
1307
  const DC_BUFFER_LOW_WATER = 1 * 1024 * 1024;
1308
- /** Safety fallback so the send loop cannot deadlock on a missed drain event. */
1309
- const DC_BUFFER_DRAIN_TIMEOUT_MS = 5000;
@@ -149,9 +149,6 @@ export function planEncoders({
149
149
  return stops;
150
150
  }
151
151
 
152
- // How far a search for a gap needs to look: past the furthest thing anybody
153
- // is waiting for there is nothing to decide about.
154
- const demandTo = Math.max(...wanted.map((span) => span.to));
155
152
  const untilNeeded = deadlineReaderFor(wanted, segmentSeconds);
156
153
  // Segments produced per second, from the fastest measured encoder here.
157
154
  // Seconds of film per second, divided by the film one piece holds.
@@ -295,6 +295,20 @@ export class EncodeRun {
295
295
  return this.head - 1;
296
296
  }
297
297
 
298
+ /**
299
+ * The last piece this run named while it was running normally.
300
+ *
301
+ * Its own statement that a piece is whole, and the only thing that can say so:
302
+ * a piece cut short still decodes, so its contents cannot be asked. Whatever
303
+ * lies beyond this name was open when the run ended, and that is what the
304
+ * clearing-up after a run reads.
305
+ *
306
+ * @returns {string | null}
307
+ */
308
+ get provenName() {
309
+ return this.#provenName;
310
+ }
311
+
298
312
  /** @returns {number[]} */
299
313
  get produced() {
300
314
  return [...this.#produced].sort((left, right) => left - right);