This commit is contained in:
2025-10-13 18:46:47 +05:00
parent d0203b1106
commit 107fbc99af
5 changed files with 41 additions and 54 deletions
+21 -22
View File
@@ -481,7 +481,7 @@ async function startApplication(session: SessionData): Promise<void> {
streamerPort = await findFreePort(8080, 9000);
playerPort = await findFreePort(Math.min(streamerPort + 1, 9000), 9000);
sfuPort = await findFreePort(Math.min(playerPort + 1, 9000), 9000);
console.log(
`[${new Date().toISOString()}] 🔌 Найдены свободные порты - Streamer: ${streamerPort}, Player: ${playerPort}, SFU: ${sfuPort}`
);
@@ -514,8 +514,6 @@ async function startApplication(session: SessionData): Promise<void> {
playerPort.toString(),
"--sfu_port",
sfuPort.toString(),
"--max_players",
"0",
],
{
detached: false,
@@ -554,7 +552,6 @@ async function startApplication(session: SessionData): Promise<void> {
});
}
// Обработка завершения Cirrus процесса
cirrusProcess.on("exit", async (code, signal) => {
console.log(
@@ -585,12 +582,18 @@ async function startApplication(session: SessionData): Promise<void> {
appProcess = spawn(
appPath,
[
`-PixelStreamingURL=ws://127.0.0.1:${streamerPort}`,
"-PixelStreamingIP=127.0.0.1",
`-PixelStreamingPort=${streamerPort}`,
"-ForceRes",
"-ResX=1920",
"-ResY=1080",
"-Unattended",
"-RenderOffScreen",
"-PixelStreamingWebRTCMinBitrate=5000000",
"-PixelStreamingWebRTCMaxBitrate=20000000",
"-PixelStreamingH264Profile=HIGH",
"-PixelStreamingWebRTCDisableReceiveAudio=true",
"-PixelStreamingEncoderRateControl=VBR",
],
{
detached: false,
@@ -604,22 +607,12 @@ async function startApplication(session: SessionData): Promise<void> {
);
} else {
// Local-режим: запускаем без Pixel Streaming
appProcess = spawn(
appPath,
[
"-ForceRes",
"-ResX=1920",
"-ResY=1080",
"-Unattended",
"-RenderOffScreen",
],
{
detached: false,
stdio: ["ignore", "ignore", "pipe"],
windowsHide: true,
cwd: `C:\\apps\\${app.name}`,
}
);
appProcess = spawn(appPath, [], {
detached: false,
stdio: ["ignore", "ignore", "pipe"],
windowsHide: true,
cwd: `C:\\apps\\${app.name}`,
});
console.log(
`[${new Date().toISOString()}] 💻 Local-режим: приложение запускается без Pixel Streaming`
);
@@ -699,7 +692,13 @@ async function startApplication(session: SessionData): Promise<void> {
// Обновить статус на "started" с PID приложения
// Для stream-режима также сохраняем Cirrus PID и порты
if (mode === "stream" && cirrusPid && streamerPort && playerPort && sfuPort) {
if (
mode === "stream" &&
cirrusPid &&
streamerPort &&
playerPort &&
sfuPort
) {
await updateSessionStatus(
sessionId,
"started",