@torrent-tv/proxy 2.107.8 → 2.107.10
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
|
@@ -41,8 +41,11 @@ export function buildAdmittedCommand({ admittedInput, timeline, output, segmentF
|
|
|
41
41
|
}
|
|
42
42
|
else video.push("-vf", trim);
|
|
43
43
|
}
|
|
44
|
+
const audioTrack = admittedInput.tracks?.find(input => input.track.type === "audio")?.track;
|
|
45
|
+
const audioSampleRate = [audioTrack?.samplingFrequency, audioTrack?.codecParameters?.sampleRate]
|
|
46
|
+
.find(sampleRate => Number.isSafeInteger(sampleRate) && sampleRate > 0) ?? 48000;
|
|
44
47
|
const audio = transcodeAudio ? ["-c:a", "aac", "-ac", "2", "-b:a", `${AUDIO_TRANSCODE_KBPS}k`,
|
|
45
|
-
"-af", `atrim=start=${ffmpegSeconds(relativeStart)}:end=${ffmpegSeconds(relativeEnd)}`] : ["-c:a", "copy"];
|
|
48
|
+
"-af", `atrim=start=${ffmpegSeconds(relativeStart)}:end=${ffmpegSeconds(relativeEnd)},aresample=async=1:first_pts=${Math.round(relativeStart * audioSampleRate)}`] : ["-c:a", "copy"];
|
|
46
49
|
if (audioOnly) args.push("-vn", "-map", "0:a:0", ...audio);
|
|
47
50
|
else if (audioSeparate) args.push("-an", "-map", "0:v:0", ...video);
|
|
48
51
|
else args.push("-map", "0:v:0", "-map", "0:a:0?", ...video, ...audio);
|
|
@@ -1280,7 +1280,10 @@ export class ViewerRequests {
|
|
|
1280
1280
|
if (output?.spec?.carries === "audio-only") {
|
|
1281
1281
|
let trend = measurement.trackProgress.get(output);
|
|
1282
1282
|
if (!trend) {
|
|
1283
|
-
trend = new this.#host.playbackReadiness.ProgressRate(
|
|
1283
|
+
trend = new this.#host.playbackReadiness.ProgressRate(
|
|
1284
|
+
this.#host.lookaheadSeconds,
|
|
1285
|
+
this.#host.segmentDurationSec
|
|
1286
|
+
);
|
|
1284
1287
|
measurement.trackProgress.set(output, trend);
|
|
1285
1288
|
}
|
|
1286
1289
|
return trend.note(now, progress?.processedSeconds, progress?.startPositionSeconds);
|
|
@@ -116,17 +116,23 @@ export class RateTrend {
|
|
|
116
116
|
export class ProgressRate {
|
|
117
117
|
#trend;
|
|
118
118
|
#horizonSeconds;
|
|
119
|
+
#adjacentRunSeconds;
|
|
119
120
|
#previous = null;
|
|
120
121
|
|
|
121
|
-
constructor(horizonSeconds) {
|
|
122
|
+
constructor(horizonSeconds, adjacentRunSeconds = 4) {
|
|
122
123
|
this.#horizonSeconds = horizonSeconds;
|
|
124
|
+
this.#adjacentRunSeconds = Number.isFinite(adjacentRunSeconds) && adjacentRunSeconds > 0
|
|
125
|
+
? adjacentRunSeconds
|
|
126
|
+
: 4;
|
|
123
127
|
this.#trend = new RateTrend(horizonSeconds);
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
note(at, processedSeconds, startPositionSeconds) {
|
|
127
131
|
if (!Number.isFinite(at) || !Number.isFinite(processedSeconds)) return this.#trend.snapshot();
|
|
128
132
|
const start = Number.isFinite(startPositionSeconds) ? startPositionSeconds : 0;
|
|
129
|
-
|
|
133
|
+
const discontinuousStart = this.#previous && start !== this.#previous.start &&
|
|
134
|
+
(start < this.#previous.start || start > this.#previous.processedSeconds + this.#adjacentRunSeconds);
|
|
135
|
+
if (!this.#previous || discontinuousStart || processedSeconds < this.#previous.processedSeconds) {
|
|
130
136
|
this.#previous = { at, processedSeconds, start };
|
|
131
137
|
this.#trend = new RateTrend(this.#horizonSeconds);
|
|
132
138
|
return this.#trend.snapshot();
|