mirror of
https://github.com/livekit/livekit.git
synced 2026-11-04 09:07:37 +00:00
processSourceSwitch added dummyStartTSOffset to extRefTS in 64 bits. When the offset is negative and the reference layer's 32-bit RTP timestamp has wrapped but is still below |offset|, the addition borrows from the upper half and extRefTS ends up 2^32 below the right value. The wrap correction that follows only compares the lower 32 bits, so it cannot undo it. The switch point then looks ~47,722 s (2^32 / 90 kHz) behind and is rejected with errSwitchPointTooFarBehind on every keyframe, until the reference layer's timestamp climbs past |offset|, which can take hours. Apply the offset modulo 2^32 before restoring the cycles from extLastTS. The lower 32 bits, and so the timestamp sent to subscribers, are unchanged.