Phase 1 spike: replace @dank074/discord-video-stream + node-datachannel +
node-av (1.3GB) with minimal libdatachannel N-API binding + native RTP
packetizers (H264 FU-A, RTCP SR/NACK, pacer) + pure-TS GoLive stack.
Binding v0.4: addTrack (m=audio/video SDP), TrackWrap w/ setPacketizer +
sendFrame (raw RTP to transport) + addTimestamp — verified by two-peer
handshake emitting SDP with audio(opus 120)+video(H264 101) and 8-frame
RTP roundtrip.
TS layer (src/goLive/, 21 files): CodecPayloadType, VoiceOpCodes,
GatewayOpCodes, utils, BaseMediaConnection (voice WS + DAVE + heartbeat),
VoiceConnection, StreamConnection, Streamer, WebRtcWrapper (SDP mungling,
DAVE encrypt, packetizer chain), BaseMediaStream (pacing/sync), VideoStream,
AudioStream, Demuxer (ffmpeg-spawn NUT/AnnexB, no node-av 114M binary),
Encoders, prepareStream/playStream.
Integration: screenShareController.ts now imports from ../../goLive/index.js —
prepareStream(prepared, ...) + playStream(prepared, streamer, {...}).
Tests: tests/goLive-port.test.ts (8/8 pass). tsc --noEmit clean. biome clean.
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
/** Discord gateway opcodes used by Streamer — ported from @dank074/discord-video-stream. */
|
|
export enum GatewayOpCodes {
|
|
DISPATCH = 0,
|
|
HEARTBEAT = 1,
|
|
IDENTIFY = 2,
|
|
PRESENCE_UPDATE = 3,
|
|
VOICE_STATE_UPDATE = 4,
|
|
VOICE_SERVER_PING = 5,
|
|
RESUME = 6,
|
|
RECONNECT = 7,
|
|
REQUEST_GUILD_MEMBERS = 8,
|
|
INVALID_SESSION = 9,
|
|
HELLO = 10,
|
|
HEARTBEAT_ACK = 11,
|
|
CALL_CONNECT = 13,
|
|
GUILD_SUBSCRIPTIONS = 14,
|
|
LOBBY_CONNECT = 15,
|
|
LOBBY_DISCONNECT = 16,
|
|
LOBBY_VOICE_STATES_UPDATE = 17,
|
|
STREAM_CREATE = 18,
|
|
STREAM_DELETE = 19,
|
|
STREAM_WATCH = 20,
|
|
STREAM_PING = 21,
|
|
STREAM_SET_PAUSED = 22,
|
|
REQUEST_GUILD_APPLICATION_COMMANDS = 24,
|
|
EMBEDDED_ACTIVITY_LAUNCH = 25,
|
|
EMBEDDED_ACTIVITY_CLOSE = 26,
|
|
EMBEDDED_ACTIVITY_UPDATE = 27,
|
|
REQUEST_FORUM_UNREADS = 28,
|
|
REMOTE_COMMAND = 29,
|
|
GET_DELETED_ENTITY_IDS_NOT_MATCHING_HASH = 30,
|
|
REQUEST_SOUNDBOARD_SOUNDS = 31,
|
|
SPEED_TEST_CREATE = 32,
|
|
SPEED_TEST_DELETE = 33,
|
|
REQUEST_LAST_MESSAGES = 34,
|
|
SEARCH_RECENT_MEMBERS = 35,
|
|
REQUEST_CHANNEL_STATUSES = 36,
|
|
GUILD_SUBSCRIPTIONS_BULK = 37,
|
|
GUILD_CHANNELS_RESYNC = 38,
|
|
REQUEST_CHANNEL_MEMBER_COUNT = 39,
|
|
}
|