mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 15:25:40 +00:00
Found another reason for potential stalling on layer switch up. When switching up, it is possible that the key frame of the packet at higher layer arrives very close to a packet in the currently forwarded layer. An inversion happens when higher layer packet arrives earlier (as timestamped at receicver), but gets scheduled for forwarding later (as seen by forwarder). Because of the order of processing goroutines, it is possible to have negative diff when trying to adjust RTP timestamps for layer switch. A negative diff results in large jump in RTP timestamp. Client stalls, sends PLI three seconds later (3 seconds is a Chrome thing, not sure about others), waits for another key frame and starts again. In the mean time, the video is frozen.