fix(voice): read SSRCMap internal map via 'map' (not '_map')

videoReceiver.getSsrcInternalMap read asAny._map, but @discordjs/voice
0.19.x exposes the SSRC map as the public field 'map'. So inferVideoOwner
(e.g. matching a video RTP SSRC to a user via audio-SSRC proximity) always
returned null -> every video packet was silently dropped after decryption.
Accept both 'map' and '_map'. Unblocks camera/screen-share attribute when
op12 does not carry a videoSSRC stream entry.
This commit is contained in:
asepharyana
2026-09-02 00:10:02 +07:00
parent 30d640ca5b
commit 7122258d7c
@@ -396,8 +396,13 @@ function getSsrcInternalMap(
| Map<number, { userId: string; audioSSRC?: number; videoSSRC?: number }>
| undefined {
const asAny = ssrcMap as unknown as Record<string, unknown>;
const m1 = asAny._map;
// @discordjs/voice 0.19.x exposes the map as `map` (public) — but some
// versions used `_map`. Accept both so attribute fallback keeps working.
const m1 = asAny.map ?? asAny._map;
if (m1 instanceof Map) return m1 as Map<number, never>;
// SSRCMap could also be the fork's class — same shape.
const m2 = asAny.map;
if (m2 instanceof Map) return m2 as Map<number, never>;
return undefined;
}