perf(player): add -re flag to FFmpeg to prevent RAM buildup on long songs

This commit is contained in:
NoLogicAlan committed 2026-06-22 21:20:11 +03:00
1 parent 6f2797c0ee
commit 771a4a0c50
1 file changed
+3 -3
+3 -3
View File
@@ -958,11 +958,11 @@ export default class Player extends EventEmitter {
url.includes("/v4/trackstream") ||
url.includes("/v4/loadstream");
if (!isNodeLink) return this._streamViaRevoice(url);
if (!isNodeLink) return this._streamViaRevoice(url, ["-re"]);
if (url.includes("/v4/loadstream")) {
logger.player(`[Player] NodeLink loadStream PCM active`);
const pcmInputOpts = ["-f", "s16le", "-ar", "48000", "-ac", "2"];
const pcmInputOpts = ["-re", "-f", "s16le", "-ar", "48000", "-ac", "2"];
return await this._streamViaRevoice(url, pcmInputOpts);
}
@@ -975,7 +975,7 @@ export default class Player extends EventEmitter {
});
if (!json?.url) throw new Error(`NodeLink gave no URL: ${JSON.stringify(json)}`);
logger.player(`[Player] NodeLink resolved stream URL`);
return this._streamViaRevoice(json.url);
return this._streamViaRevoice(json.url, ["-re"]);
} catch (err) {
logger.error("[Player] NodeLink resolve error:", err.message);
throw new Error(sanitizeError(err.message, this._nl));