@torrent-tv/proxy 2.95.25 → 2.95.27

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.25",
3
+ "version": "2.95.27",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -232,8 +232,13 @@ export class AviContainer extends Container {
232
232
  } else if (type === "audio") {
233
233
  if (strf.length < 16) throw new Error("AVI wave format is truncated.");
234
234
  const tag = strf.readUInt16LE(0);
235
+ // WAVEFORMATEX states the average bytes per second the stream carries
236
+ // (`nAvgBytesPerSec`); zero states nothing. Without it a soundtrack the
237
+ // browser plays is re-encoded only because its copy has no figure to
238
+ // ask the link about (torrent-tv/meta#159).
235
239
  track = new AudioTrack({ ...params, codecId: waveCodec(tag),
236
240
  channels: strf.readUInt16LE(2), samplingFrequency: strf.readUInt32LE(4),
241
+ bitrateKbps: strf.readUInt32LE(8) * 8 / 1000,
237
242
  codecPrivateB64: strf.subarray(18).toString("base64") });
238
243
  track.blockAlign = strf.readUInt16LE(12);
239
244
  track.matroskaCodecId = "A_MS/ACM";
@@ -78,6 +78,8 @@ export class AudioTrack extends ContainerTrack {
78
78
  * @param {boolean} params.isVisualImpaired - FlagVisualImpaired / descriptive audio
79
79
  * @param {number | null} params.channels
80
80
  * @param {number | null} params.samplingFrequency
81
+ * @param {number | null} [params.bitrateKbps] - The rate the file states for
82
+ * this track, in kbit/s: an average, not a bound.
81
83
  */
82
84
  constructor(params) {
83
85
  super({ ...params, type: "audio" });
@@ -86,6 +88,7 @@ export class AudioTrack extends ContainerTrack {
86
88
  this.isVisualImpaired = params.isVisualImpaired === true;
87
89
  this.channels = Number.isFinite(params.channels) ? params.channels : null;
88
90
  this.samplingFrequency = Number.isFinite(params.samplingFrequency) ? params.samplingFrequency : null;
91
+ this.bitrateKbps = Number.isFinite(params.bitrateKbps) && params.bitrateKbps > 0 ? params.bitrateKbps : null;
89
92
  this.bitDepth = Number.isSafeInteger(params.bitDepth) && params.bitDepth > 0 ? params.bitDepth : null;
90
93
  this.codecDelaySeconds = Number.isFinite(params.codecDelaySeconds) && params.codecDelaySeconds >= 0 ? params.codecDelaySeconds : 0;
91
94
  // What the codec is configured as, and the most that configuration allows
@@ -1489,6 +1489,13 @@ export class TorrentPool {
1489
1489
  torrent.on("download-request-cancel-failed", ({ piece, offset, length, error }) => {
1490
1490
  logger.warn(`download request=${torrent.infoHash ?? "unknown"}:${piece}:${offset} cancel bytes=${length} failed: ${error}`);
1491
1491
  });
1492
+ // WHEN each piece arrived. The requests above say what was asked for; this
1493
+ // says what came and in which order, which is what decides how far an
1494
+ // encoder reading the file can go before it meets a piece still missing
1495
+ // (torrent-tv/meta#151). One short line per piece: a 2.3 GB film is 563.
1496
+ torrent.on("verified", (piece) => {
1497
+ logger.info(`download ${label()} verified piece=${piece}`);
1498
+ });
1492
1499
 
1493
1500
  // The first connected peer, said once, because the wait for it can BE the
1494
1501
  // whole cold start and nothing else measures it.