perf(golive): ffmpeg-spawn demuxer (no node-av) + E2E pipeline tests
Phase 2 — replace the 114MB node-av binary with a plain ffmpeg spawn:
Demuxer.ts: spool stream input to temp file → probe via ffmpeg stderr
(ffmpeg-headless ships NO ffprobe — parse 'Stream #0:0: Video: h264...
640x360, 30 fps' from -loglevel info) → ffmpeg -c copy -f h264 pipe:1
→ NAL-split frames. Falls back to h264 defaults when probe fails.
prepareStream.ts: resolve ffmpeg from FFMPEG_PATH env → Nix store
ffmpeg-headless (hash-prefixed entry!) → PATH; split encoder option
strings ('-forced-idr 1' → two argv) — fluent-ffmpeg used to split
automatically, spawn does not.
E2E tests (tsx, need LD_LIBRARY_PATH=/tmp/ldc-build):
- golive-demux-e2e.ts: real H264 file → 33 NAL frames + dims from probe
- golive-pipeline-e2e.ts: prepareStream → demux → 82 frames
- golive-videostream-e2e.ts: local peer pair → demux → VideoStream →
native setPacketizer/sendFrame/addTimestamp → 33 frames sent connected
Pitfalls captured: setPacketizer before negotiation breaks createOffer
('No DataChannel or Track to negotiate'); track methods are read-only
(no monkeypatching); both peers must declare audio+video tracks or
answer hangs; state() returns 'closed' after close() — snapshot first.
This commit is contained in:
@@ -27,7 +27,7 @@ export interface StreamerClientLike {
|
||||
broadcast(data: { op: number; d: unknown }): void;
|
||||
};
|
||||
guilds?: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- discord.js-selfbot client shape is dynamic
|
||||
// biome-ignore lint/suspicious/noExplicitAny: discord.js-selfbot client shape is dynamic
|
||||
fetch(id: string): Promise<any>;
|
||||
};
|
||||
}
|
||||
@@ -199,7 +199,7 @@ export class Streamer {
|
||||
const { guildId } = this.voiceConnection.streamConnection;
|
||||
if (!this.client.guilds) return;
|
||||
const server = await this.client.guilds.fetch(guildId);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any -- discord.js-selfbot dynamic
|
||||
// biome-ignore lint/suspicious/noExplicitAny: discord.js-selfbot dynamic
|
||||
(server as any).members.me?.voice?.postPreview(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user