feat(gateway): close video burst promptly when a user's SSRC is removed
ssrcMap emits "delete" when a VoiceUserData is removed (user stops sharing / leaves voice). Hook it to close the user's open video burst ~500ms later so the ffmpeg mux starts as soon as they stop, instead of waiting up to 5s for the idle sweep. No-op if no burst exists; safe on normal teardown.
This commit is contained in:
@@ -336,6 +336,14 @@ export function hookVideoReceiver(
|
||||
|
||||
// If a user's video SSRC disappears, close their burst after a short grace so
|
||||
// the tail flushes.
|
||||
receiver.ssrcMap.on("delete", (data) => {
|
||||
// data = the deleted VoiceUserData (userId + audioSSRC). Close any open
|
||||
// video burst for that user so the mux starts as soon as they stop sharing.
|
||||
if (data?.userId) {
|
||||
setTimeout(() => closeBurst(data.userId), 500);
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
const now = Date.now();
|
||||
for (const [userId, burst] of bursts) {
|
||||
|
||||
Reference in New Issue
Block a user