@torrent-tv/proxy 2.101.17 → 2.101.19

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.101.17",
3
+ "version": "2.101.19",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -423,8 +423,8 @@ export class EncodeRuns {
423
423
  const cut = cutOf(session.timeline, index);
424
424
  const grid = session.timeline.published ?? session.timeline.boundaries;
425
425
  const interval = admitted ? { from: grid?.[index], to: grid?.[index + 1],
426
- // Embedded copied sound was selected by presentationSegment on the
427
- // published grid, so its raw muxer cut shift no longer applies.
426
+ // Copied sound is cut on the published grid, so the run's raw muxer
427
+ // clock shift must not be applied to its AAC interval.
428
428
  ...(audioOnPublishedGrid ? { shiftByKind: { soun: 0 } } : {}),
429
429
  ...(index === session.timeline.segmentCount - 1 ? { endsWithSource: true, sourceEnds: Object.fromEntries(
430
430
  (admitted.tracks ?? []).filter(input => Number.isFinite(input.sourceEndSeconds))
@@ -1167,12 +1167,15 @@ export class EncodeRuns {
1167
1167
  const address = session.outputKey ?? "";
1168
1168
  // Read before anything rewrites it: when the encoder finished it.
1169
1169
  const writtenAt = this.#host.segmentFiles.writtenAtOf?.(address, name) ?? null;
1170
- const fmp4 = admittedInput && session.segmentFormat.id === "fmp4" && session.spec.carries !== "audio-only";
1170
+ const fmp4 = admittedInput && session.segmentFormat.id === "fmp4";
1171
+ const pictureFmp4 = fmp4 && session.spec.carries !== "audio-only";
1171
1172
  // The first piece of a run that read the picture from its keyframe:
1172
1173
  // its leading pictures are the ones the run before made, or none.
1173
- const firstOfRun = fmp4 && this.#copiesOriginalPicture(session, admittedInput) &&
1174
+ const firstOfRun = pictureFmp4 && this.#copiesOriginalPicture(session, admittedInput) &&
1174
1175
  index === run.from && index > 0 && !fromKeyframeBefore;
1175
- const soundInPiece = fmp4 && session.spec.audio && !this.#host.servesAudioSeparately(session);
1176
+ const soundInPiece = pictureFmp4 && session.spec.audio && !this.#host.servesAudioSeparately(session);
1177
+ const audioOnPublishedGrid = fmp4 && session.spec.audio && !session.spec.transcodesAudio &&
1178
+ (session.spec.carries === "audio-only" || !this.#host.servesAudioSeparately(session));
1176
1179
  if (firstOfRun || soundInPiece) {
1177
1180
  try {
1178
1181
  const grid = session.timeline.published ?? session.timeline.boundaries;
@@ -1186,7 +1189,7 @@ export class EncodeRuns {
1186
1189
  }
1187
1190
  }
1188
1191
  const mediaRanges = this.#wholeClosedPiece(session, name, index, admittedInput, bytes, run, timing, following,
1189
- { tentative, audioOnPublishedGrid: soundInPiece });
1192
+ { tentative, audioOnPublishedGrid });
1190
1193
  // Tried on its own line and not proved whole: it waits for the next file.
1191
1194
  if (mediaRanges === false && tentative) return null;
1192
1195
  if (mediaRanges === false) throw Object.assign(new Error(`Closed piece #${index} has incomplete media.`),
@@ -430,7 +430,10 @@ export class QualityController {
430
430
  // it is read as a copy.
431
431
  const unchanged = standing && standingBefore &&
432
432
  standing.height === standingBefore.height && standing.at === standingBefore.at;
433
- if (unchanged && !this.#affirmed.has(consumerId)) {
433
+ const urgentMachineDown = unchanged && standing.urgent === true &&
434
+ standing.reason.startsWith("machine-bound ");
435
+ const machineRecovered = !urgentMachineDown || this.#roomToSpare(session, consumerId);
436
+ if (unchanged && !this.#affirmed.has(consumerId) && machineRecovered) {
434
437
  this.#host.dropAskOf(base, consumerId);
435
438
  logger.info(
436
439
  `[budget] transcode ${base.id} no longer asks ${consumerId} for ${standing.height}p: ` +