feat: enhance webcam recording initialization timing
- Increase initial wait time to 8s for better connection stability - Add SSRC mapping readiness check with 15s timeout - Extend camera detection retry interval to 2s - Add comprehensive SSRC mapping debug logging before recording - Better state validation before starting webcam stream
This commit is contained in:
parent
9470815ad1
commit
3f2918a7d5
3 changed files with 39 additions and 9 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit c1d0b98a487eda0557d29135024d1eb3c72b968d
|
Subproject commit d8e4393ff525f1fd5ccf3bd6c9407b0596e3d9a4
|
||||||
12
entry.sh
12
entry.sh
|
|
@ -13,12 +13,12 @@ openbox &
|
||||||
x11vnc -display :99 -shared -forever -nopw -rfbport 5901 -bg &
|
x11vnc -display :99 -shared -forever -nopw -rfbport 5901 -bg &
|
||||||
|
|
||||||
# Launch discord in the background. THIS IS THE FIX.
|
# Launch discord in the background. THIS IS THE FIX.
|
||||||
discord \
|
# discord \
|
||||||
--no-sandbox \
|
# --no-sandbox \
|
||||||
--disable-dev-shm-usage \
|
# --disable-dev-shm-usage \
|
||||||
--disable-gpu \
|
# --disable-gpu \
|
||||||
--disable-background-timer-throttling \
|
# --disable-background-timer-throttling \
|
||||||
--disable-renderer-backgrounding &
|
# --disable-renderer-backgrounding &
|
||||||
|
|
||||||
# Give Discord a moment to start before launching the controller script
|
# Give Discord a moment to start before launching the controller script
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,26 @@ class WebcamRecordingService {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Wait longer for connection and SSRC mapping to be fully established
|
// Wait longer for connection and SSRC mapping to be fully established
|
||||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
await new Promise((resolve) => setTimeout(resolve, 8000));
|
||||||
|
|
||||||
|
// Wait for SSRC mapping to be populated
|
||||||
|
let ssrcRetries = 0;
|
||||||
|
const maxSSRCRetries = 15;
|
||||||
|
while (ssrcRetries < maxSSRCRetries) {
|
||||||
|
if (connection.ssrcMap && connection.ssrcMap.size > 0) {
|
||||||
|
console.log(
|
||||||
|
`[Docker] SSRC mapping ready with ${connection.ssrcMap.size} entries after ${ssrcRetries} retries`
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
`[Docker] Waiting for SSRC mapping... (${
|
||||||
|
ssrcRetries + 1
|
||||||
|
}/${maxSSRCRetries})`
|
||||||
|
);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
ssrcRetries++;
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for user's camera to be detected in voice state
|
// Wait for user's camera to be detected in voice state
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
|
|
@ -73,7 +92,7 @@ class WebcamRecordingService {
|
||||||
retries + 1
|
retries + 1
|
||||||
}/${maxRetries})`
|
}/${maxRetries})`
|
||||||
);
|
);
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||||
retries++;
|
retries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,6 +102,17 @@ class WebcamRecordingService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log final SSRC state before starting recording
|
||||||
|
console.log(
|
||||||
|
`[Docker] Starting webcam recording with SSRC map:`,
|
||||||
|
Array.from(connection.ssrcMap.entries()).map(([ssrc, data]) => ({
|
||||||
|
ssrc,
|
||||||
|
userId: data.userId?.slice(-4),
|
||||||
|
streamType: data.streamType,
|
||||||
|
hasVideo: data.hasVideo,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
console.log(`[Docker] Creating webcam stream for user ${user.id}`);
|
console.log(`[Docker] Creating webcam stream for user ${user.id}`);
|
||||||
|
|
||||||
// Create webcam stream with retry logic
|
// Create webcam stream with retry logic
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue