@torrent-tv/proxy 2.95.38 → 2.95.39
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
|
@@ -1682,13 +1682,15 @@ export function pickSoftwarePreset(benchmark, pixelsPerSecNeeded, cost = {}, fra
|
|
|
1682
1682
|
if (encodePixelsPerSec === null) {
|
|
1683
1683
|
continue;
|
|
1684
1684
|
}
|
|
1685
|
-
const speed =
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1685
|
+
const speed = typeof cost.speedForPreset === "function"
|
|
1686
|
+
? cost.speedForPreset([entry], frame, pixelsPerSecNeeded)
|
|
1687
|
+
: predictedRealtimeSpeed({
|
|
1688
|
+
decodeModel: cost.decodeModel ?? null,
|
|
1689
|
+
encodePixelsPerSec,
|
|
1690
|
+
outputPixelsPerSec: pixelsPerSecNeeded,
|
|
1691
|
+
source: cost.source ?? null,
|
|
1692
|
+
observedDecodeCostSec: observed
|
|
1693
|
+
});
|
|
1692
1694
|
if (speed !== null && speed >= bar) {
|
|
1693
1695
|
return entry.preset;
|
|
1694
1696
|
}
|
|
@@ -1786,12 +1788,15 @@ export function chooseSoftwareEncodeSettings(benchmark, ceiling, outputFps, cost
|
|
|
1786
1788
|
if (fastest === null) {
|
|
1787
1789
|
continue;
|
|
1788
1790
|
}
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1791
|
+
const outputPixelsPerSec = ladder[i].width * ladder[i].height * fps;
|
|
1792
|
+
const speed = typeof cost.speedForPreset === "function"
|
|
1793
|
+
? cost.speedForPreset([benchmark.at(-1)], ladder[i], outputPixelsPerSec)
|
|
1794
|
+
: predictedRealtimeSpeed({
|
|
1795
|
+
decodeModel: cost.decodeModel ?? null,
|
|
1796
|
+
encodePixelsPerSec: fastest,
|
|
1797
|
+
outputPixelsPerSec,
|
|
1798
|
+
source: cost.source ?? null
|
|
1799
|
+
});
|
|
1795
1800
|
if (speed !== null && speed >= bar) {
|
|
1796
1801
|
chosenIndex = i;
|
|
1797
1802
|
break;
|
|
@@ -172,6 +172,21 @@ export class EncodeCost {
|
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
#committedMachineCostSec() {
|
|
176
|
+
let cost = 0;
|
|
177
|
+
for (const session of this.#outputs.values()) {
|
|
178
|
+
if (!processCanBeSignalled(this.#stateFor(session))) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const measured = this.#loadOfSession(session)?.costSec;
|
|
182
|
+
if (!Number.isFinite(measured) || measured <= 0) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
cost += measured;
|
|
186
|
+
}
|
|
187
|
+
return cost;
|
|
188
|
+
}
|
|
189
|
+
|
|
175
190
|
// The last refusal printed. The offer is recomputed on the path that serves
|
|
176
191
|
// every playlist, init and segment, and the figures behind it move every few
|
|
177
192
|
// seconds — so the line is written when the ANSWER changes, not when it is
|
|
@@ -1085,11 +1100,26 @@ export class EncodeCost {
|
|
|
1085
1100
|
if (!ceiling) {
|
|
1086
1101
|
return null;
|
|
1087
1102
|
}
|
|
1103
|
+
const concurrentCostSec = this.#committedMachineCostSec();
|
|
1104
|
+
const speedForPreset = (benchmark, frame, outputPixelsPerSec) => {
|
|
1105
|
+
if (concurrentCostSec === null) {
|
|
1106
|
+
return null;
|
|
1107
|
+
}
|
|
1108
|
+
return this.#speedOnThisMachine({
|
|
1109
|
+
benchmark,
|
|
1110
|
+
source,
|
|
1111
|
+
width: frame.width,
|
|
1112
|
+
height: frame.height,
|
|
1113
|
+
fps: outputPixelsPerSec / (frame.width * frame.height),
|
|
1114
|
+
observedDecodeCostSec: null,
|
|
1115
|
+
concurrentCostSec
|
|
1116
|
+
});
|
|
1117
|
+
};
|
|
1088
1118
|
return chooseSoftwareEncodeSettings(
|
|
1089
1119
|
this.#host().benchmark,
|
|
1090
1120
|
{ width: ceiling.w, height: ceiling.h },
|
|
1091
1121
|
outputFps,
|
|
1092
|
-
{ decodeModel: this.#host().decodeModel, source, requiredSpeed }
|
|
1122
|
+
{ decodeModel: this.#host().decodeModel, source, requiredSpeed, speedForPreset }
|
|
1093
1123
|
);
|
|
1094
1124
|
}
|
|
1095
1125
|
}
|