feat(gateway): hexdump+ssrc of watch UDP packets

maxLen stayed 72 across 243 packets (no real H264, which is hundreds+ bytes) —
only 44-72-byte RTP packets on PT 76/72/73 arrive. Add ssrc + first-32-bytes
hex so we can identify exactly what Discord sends to the watch socket (control
packets vs stale video), which determines whether the gap is upstream routing
or whether large H264 packets are missing entirely.
This commit is contained in:
asepharyana
2026-08-31 16:47:27 +07:00
parent b423d21b23
commit 9606187861
@@ -476,9 +476,12 @@ function handleUdpMessage(
watch._diag = stat;
const diagCount = stat.video;
const dueAt = watch._diagNext ?? 0;
if (diagCount <= 3 || now >= dueAt) {
if (diagCount === 1 || now >= dueAt) {
watch._diagNext = now + 20_000;
const pts = [...stat.pts].join(",");
const ssrc = msg.readUInt32BE(8);
const first = msg[0];
const flags = msg[1];
logger.info(
{
userId: uid,
@@ -488,9 +491,13 @@ function handleUdpMessage(
haveKey,
daveAttached: !!dave?.session,
daveReady,
watchesSize: watches.size,
ssrc,
firstByte: first,
flagsByte: flags,
seq: msg.readUInt16BE(2),
hex: msg.subarray(0, 32).toString("hex"),
},
`VIDEO-PKT diag video=${stat.video} maxLen=${stat.maxLen} pts=[${pts}] haveKey=${haveKey} dave=${!!dave?.session} ready=${daveReady}`,
`VIDEO-PKT diag video=${stat.video} maxLen=${stat.maxLen} pts=[${pts}] haveKey=${haveKey} dave=${!!dave?.session} ready=${daveReady} ssrc=${ssrc} first=${first} flags=${flags} hex=${msg.subarray(0, 32).toString("hex")}`,
);
}
const decrypted = decryptVideoPacket(