@torrent-tv/proxy 2.105.11 → 2.105.12

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.105.11",
3
+ "version": "2.105.12",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -519,17 +519,27 @@ export function predictPlaybackReadiness(input = {}) {
519
519
  const ahead = secondsAhead(earliest(before, trackEnd), at);
520
520
  constrain(completion.at - ahead, "delivery", trackIndex, completion.segment.index, completion.at, ahead, false,
521
521
  completion.sourceArrivalAt, completion.sourcePlanned);
522
- if (compare(after, before) <= 0 && completion.segment.ranges.some(({ start }) => compare(start, before) > 0)) {
522
+ const beyond = completion.segment.ranges.filter(({ start }) => compare(start, before) > 0);
523
+ if (compare(after, before) <= 0 && beyond.length > 0) {
523
524
  // A timestamp hole cannot be repaired by waiting longer. Keep it
524
525
  // distinct from an unavailable rate or a slow but finite service.
525
- return result(false, null, buffered, reserve, null, 'media-continuity-unavailable', preparedSegments);
526
+ // Said with the track and both edges: the refusals of
527
+ // torrent-tv/meta#105 could not be told apart afterwards.
528
+ return { ...result(false, null, buffered, reserve, null, 'media-continuity-unavailable', preparedSegments),
529
+ discontinuity: { trackId: state.track.id ?? trackIndex, segmentIndex: completion.segment.index,
530
+ contiguousEndSeconds: toSeconds(before),
531
+ rangeStartSeconds: toSeconds(earliest(...beyond.map(({ start }) => start))) } };
526
532
  }
527
533
  }
528
534
  if (compare(after, trackEnd) < 0) {
529
535
  // Everything this track still needs has been delivered in the schedule
530
536
  // and its media still stops short of the end: a hole between ranges
531
537
  // already held, which no arrival crosses.
532
- return result(false, null, buffered, reserve, null, 'media-continuity-unavailable', preparedSegments);
538
+ const next = delivered.find(({ start }) => compare(start, after) > 0);
539
+ return { ...result(false, null, buffered, reserve, null, 'media-continuity-unavailable', preparedSegments),
540
+ discontinuity: { trackId: state.track.id ?? trackIndex, segmentIndex: null,
541
+ contiguousEndSeconds: toSeconds(after), rangeStartSeconds: next ? toSeconds(next.start) : null,
542
+ trackEndSeconds: toSeconds(trackEnd) } };
533
543
  }
534
544
  for (const production of productions.filter((item) => item.trackIndex === trackIndex)) {
535
545
  const before = contiguousEnd(prepared, at);