@torrent-tv/proxy 2.80.8 → 2.80.9

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.
@@ -3801,7 +3801,6 @@ export class HlsSessionManager {
3801
3801
  const staleAfterMs = this.presenceStaleAfterMs();
3802
3802
  const now = Date.now();
3803
3803
  for (const [address, sessions] of byOutput) {
3804
- const coverage = this.encodeOrchestrator.coverageOf(address);
3805
3804
  // From the TIMELINE, which is where how a file is cut has lived since
3806
3805
  // 2.76.0. Read off the session it left, this was `undefined` on every
3807
3806
  // session ever made: the map then held no length, and the walk that
@@ -3810,9 +3809,8 @@ export class HlsSessionManager {
3810
3809
  // 2026-09-05 with the stack read out of the live process.
3811
3810
  const segmentCount = Number(sessions[0].timeline?.segmentCount) || 0;
3812
3811
  if (segmentCount > 0) {
3813
- coverage.setSegmentCount(segmentCount);
3812
+ this.encodeOrchestrator.setSegmentCount(address, segmentCount);
3814
3813
  }
3815
- coverage.markReadyAll(this.segmentStore.provenNumbers(address));
3816
3814
  for (const session of sessions) {
3817
3815
  for (const run of liveRunsOf(session)) {
3818
3816
  this.encodeOrchestrator.adopt(address, run);
@@ -5418,22 +5416,12 @@ export class HlsSessionManager {
5418
5416
  * @returns {number} The last number to work through, or `-1` for the end.
5419
5417
  */
5420
5418
  #runEndFrom(session, startIndex, exceptRun = null) {
5421
- const key = session.outputKey ?? "";
5422
- if (!key) {
5423
- return -1;
5424
- }
5425
- const coverage = this.encodeOrchestrator.coverageOf(key);
5426
- const segmentCount = Number(session.timeline?.segmentCount) || 0;
5427
- if (segmentCount > 0) {
5428
- coverage.setSegmentCount(segmentCount);
5429
- }
5430
- coverage.markReadyAll(this.segmentStore.provenNumbers(key));
5431
- const free = coverage.freeRunFrom(Math.max(0, startIndex), exceptRun);
5432
- if (!Number.isFinite(free)) {
5433
- return -1;
5434
- }
5435
- const end = Math.max(0, startIndex) + Math.max(1, free) - 1;
5436
- return segmentCount > 0 && end >= segmentCount - 1 ? -1 : end;
5419
+ return this.encodeOrchestrator.freeStretchEnd({
5420
+ address: session.outputKey ?? "",
5421
+ from: startIndex,
5422
+ exceptRun,
5423
+ segmentCount: Number(session.timeline?.segmentCount) || 0
5424
+ });
5437
5425
  }
5438
5426
 
5439
5427
  // Returns the encoder it built, or nothing when there was nothing to build.