@torrent-tv/proxy 2.9.133 → 2.9.134
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/services/hls-session-manager.js +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2.9.134
|
|
2
|
+
|
|
3
|
+
- **Fix**: The line reporting how long a segment waited before anyone decided to restart for it now prints. A restart backs off a segment or two from what was asked for, so the request that prompted it is recorded under a higher index than the run starts at; looking it up by the start index alone found nothing, and the instrument added in 2.9.132 never said a word. It now takes the earliest request at or above the index the run begins from.
|
|
4
|
+
|
|
1
5
|
## 2.9.133
|
|
2
6
|
|
|
3
7
|
- **Fix**: A restarted encoder no longer waits for its predecessor to die — every seek is about a second shorter. Runs shared one output directory, so two of them writing `segment-00042.mp4` at once would produce a file that is neither; the only defence was to kill the old run and block until it was gone. Measured 2.9.132 across four seeks: 712, 852, 882 and 1297 ms, against 11-15 ms of everything else a restart does. So that wait WAS the restart. Each run now writes into a directory of its own, which makes the collision impossible, so the new run starts at once and the old one is left to die in the background. Serving a segment searches the run directories newest-first, because a later run's answer supersedes an earlier one's — the older file may be the truncated output of a run that was killed mid-write, which is precisely what sharing a directory used to hide. Covered by a test that lays out two runs and insists the newer one wins.
|
package/package.json
CHANGED
|
@@ -2273,7 +2273,16 @@ export class HlsSessionManager {
|
|
|
2273
2273
|
session.runSerial = (session.runSerial ?? 0) + 1;
|
|
2274
2274
|
session.runDirPath = path.join(session.dirPath, `run-${session.runSerial}`);
|
|
2275
2275
|
await mkdir(session.runDirPath, { recursive: true });
|
|
2276
|
-
|
|
2276
|
+
// The restart backs off a segment or two from what was asked for, so the
|
|
2277
|
+
// request that prompted it is recorded under a HIGHER index than the run
|
|
2278
|
+
// starts at. Looking it up by the start index alone found nothing and the
|
|
2279
|
+
// line never printed once.
|
|
2280
|
+
let wantedAt = null;
|
|
2281
|
+
for (const [index, at] of session.firstWantedAt ?? []) {
|
|
2282
|
+
if (index >= startIndex && (wantedAt === null || at < wantedAt)) {
|
|
2283
|
+
wantedAt = at;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2277
2286
|
if (typeof wantedAt === "number") {
|
|
2278
2287
|
logger.info(
|
|
2279
2288
|
`transcode ${session.id} restart for #${startIndex} decided ` +
|