@torrent-tv/proxy 2.98.4 → 2.98.5

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.98.4",
3
+ "version": "2.98.5",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -341,6 +341,14 @@ export class PlaybackProjection {
341
341
  #ordered = true;
342
342
  /** The segments wanted whose ranges are not worked out yet. @type {Set<Segment>} */
343
343
  #unresolved = new Set();
344
+ /**
345
+ * Outputs whose next run's input is to be raised again before the windows
346
+ * are told: worked out once for everything a map or a pass changed, not at
347
+ * each segment that changed — on a cold start that was once for each of
348
+ * 4500 segments worked out (r34, torrent-tv/meta#178).
349
+ * @type {Set<OutputState>}
350
+ */
351
+ #raiseAgain = new Set();
344
352
  /** The time base of the last map, or 0 for a map stated in absolute time. */
345
353
  #base = 0;
346
354
  #absolute = true;
@@ -408,6 +416,7 @@ export class PlaybackProjection {
408
416
  segment.ready = now;
409
417
  this.#activate(segment);
410
418
  this.#track(segment);
419
+ this.#raiseAgain.add(output);
411
420
  reworked++;
412
421
  }
413
422
  }
@@ -423,8 +432,8 @@ export class PlaybackProjection {
423
432
  }
424
433
  if (leadMoved) for (const segment of output.segments) if (this.#reckon(segment)) reworked++;
425
434
  }
435
+ if (fresh || output.target !== (info.target ?? null)) this.#raiseAgain.add(output);
426
436
  output.target = info.target ?? null;
427
- this.#raise(output);
428
437
  }
429
438
  for (const output of [...this.#outputs.values()]) if (!seen.has(output.outputKey)) this.#dropOutput(output);
430
439
  if (nextBase !== this.#base || absolute !== this.#absolute) this.#told = null;
@@ -463,7 +472,7 @@ export class PlaybackProjection {
463
472
  }
464
473
  this.#activate(segment);
465
474
  this.#track(segment);
466
- this.#raise(segment.output);
475
+ this.#raiseAgain.add(segment.output);
467
476
  }
468
477
 
469
478
  /**
@@ -507,6 +516,8 @@ export class PlaybackProjection {
507
516
  * deferred: boolean, deadlineAt?: number, standing: true }>}
508
517
  */
509
518
  windows() {
519
+ for (const output of this.#raiseAgain) if (this.#outputs.get(output.outputKey) === output) this.#raise(output);
520
+ this.#raiseAgain.clear();
510
521
  if (this.#told && this.#dirty.size === 0) return this.#told;
511
522
  for (const key of this.#dirty) this.#makeWindows(key);
512
523
  this.#dirty.clear();
@@ -560,6 +571,7 @@ export class PlaybackProjection {
560
571
  this.#lead(segment);
561
572
  this.#activate(segment);
562
573
  this.#track(segment);
574
+ this.#raiseAgain.add(segment.output);
563
575
  return true;
564
576
  }
565
577
 
@@ -753,6 +765,7 @@ export class PlaybackProjection {
753
765
  this.#unresolved.delete(segment);
754
766
  }
755
767
  this.#outputs.delete(output.outputKey);
768
+ this.#raiseAgain.delete(output);
756
769
  this.#told = null;
757
770
  }
758
771
  }