@torrent-tv/proxy 2.95.35 → 2.95.36

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.95.35",
3
+ "version": "2.95.36",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -494,11 +494,13 @@ export class EncodeRuns {
494
494
  // each: 454 pieces against 401 on the field file.
495
495
  for (const [address, sessions] of byOutput) {
496
496
  const timeline = sessions[0].timeline;
497
+ const spec = sessions[0].spec;
497
498
  this.#host.encodeOrchestrator.notePriorityMap(
498
499
  address,
499
500
  timeline?.inSegments?.(
500
501
  this.#host.priority.mapForOutput(address),
501
- Number(timeline?.segmentCount) || 0
502
+ Number(timeline?.segmentCount) || 0,
503
+ { runsPastEnd: Boolean(spec?.audio) && spec?.transcodesAudio !== true }
502
504
  ) ?? []
503
505
  );
504
506
  }
@@ -159,10 +159,13 @@ export class Timeline {
159
159
  * @param {import("../../viewer/PriorityMap.js").PriorityMap} map - One number
160
160
  * per second of film.
161
161
  * @param {number} segmentCount - How many pieces this output has.
162
+ * @param {{ runsPastEnd?: boolean }} [shape] - `runsPastEnd`: the output's
163
+ * pieces copy a stream, which is cut where its packets end, so a piece
164
+ * holds sound past its published end by up to one packet.
162
165
  * @returns {import("../../viewer/PriorityMap.js").DemandZone[]} Runs of pieces
163
166
  * that agree. Empty where nothing is stated, which says nobody is coming.
164
167
  */
165
- inSegments(map, segmentCount) {
168
+ inSegments(map, segmentCount, { runsPastEnd = false } = {}) {
166
169
  if (!(segmentCount > 0) || !map || !(map.durationSeconds > 0)) {
167
170
  return [];
168
171
  }
@@ -173,9 +176,17 @@ export class Timeline {
173
176
  // whole, so it is wanted as soon as the soonest second inside it is
174
177
  // wanted — and the piece a viewer is standing in the middle of is wanted
175
178
  // exactly as much as the second under their feet.
179
+ // A COPIED PIECE ALSO HOLDS THE SECOND ITS END FALLS IN. A copy ends at
180
+ // the first packet boundary at or after its published end, and the
181
+ // player places the next piece where this one truly ends (hls.js
182
+ // `updateFragPTSDTS` carries a parsed piece's end to every later one).
183
+ // Field 2026-10-09, MP3 copied out of an AVI on a 4 s grid: pieces ended
184
+ // up to 24 ms late, and a seek to 4000 s asked for the piece ending at
185
+ // 4000 s, which nothing made because second 4000 belonged to the next.
176
186
  const from = Math.max(0, Math.floor(this.publishedStartOf(index)));
187
+ const end = this.publishedStartOf(index + 1);
177
188
  const until = index + 1 < segmentCount
178
- ? Math.max(from + 1, Math.ceil(this.publishedStartOf(index + 1)))
189
+ ? Math.max(from + 1, runsPastEnd ? Math.floor(end) + 1 : Math.ceil(end))
179
190
  : map.durationSeconds;
180
191
  let priority = 0;
181
192
  let withinSeconds = Number.POSITIVE_INFINITY;