fix(selfbot): gate broadcast 'live' on real Go-Live WebRTC connect
isActive() was a local flag set at start() time, and start() fired playStream without awaiting the actual stream connection, so 'broadcasting' was reported even when nothing reached Discord (auto-start log + ffmpeg/NVENC running are not proof of transmission). start() now waits for the streaming library's real readiness signal (the stream connection's WebRTC reaching "connected") before declaring live. On timeout it logs a compact connection-state diagnostic, tears the local ffmpeg pipeline down immediately, and returns an explicit failure. isActive() reports the real live state. Timeout is config-driven (STREAM_READY_TIMEOUT_MS, default 25s). Adds a test for the timeout/teardown path and updates the existing leak-teardown test. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,11 @@ export const config = {
|
||||
|
||||
// selfbot backend (ToS-risk; use a throwaway account token, never your main)
|
||||
selfbotToken: opt("DISCORD_SELFBOT_TOKEN"),
|
||||
// How long to wait for the Go-Live stream WebRTC to actually reach
|
||||
// "connected" before declaring the broadcast failed (and tearing the local
|
||||
// ffmpeg pipeline down). Guards against reporting "live" when nothing reaches
|
||||
// Discord.
|
||||
streamReadyTimeoutMs: parseInt(opt("STREAM_READY_TIMEOUT_MS", "25000"), 10),
|
||||
// Use NVENC hardware encode + hw-accelerated decode for the stream (RTX 5050).
|
||||
streamHw: opt("STREAM_HW", "1") !== "0",
|
||||
// Capture desktop audio into the broadcast so the stream has sound. Pulls the
|
||||
|
||||
Reference in New Issue
Block a user