mirror of
https://github.com/livekit/livekit.git
synced 2026-04-03 21:25:40 +00:00
* Try sending small key frames to clear decoded buffer Problem: -------- With transceiver re-use, client disables/enables tracks. With video, this retains the last picture and when a new track starts, there is a brief moment when the old stream is displayed till there is data from new stream to decode and display. Fix: --- Send small key frames before closing DownTrack to try and clear the decoder display buffer. Testing: -------- Tried with Chrome/Safari/Firefox and they worked. But, very rarely, the last frames do not seem to show up. In fact, 6 frames are sent and webrtc internals (in Firefox) reports anywhere from 1 - 6 frames at the small resolution. Unclear as to why it does not get all the frames or why it reports less than 6. A not so small percentage of times (maybe 1 in 15 - 20), have seen no small frame reported at all. TODO: ---- - Have to support more video codecs - Would this be an issue for audio also? Should we send something to handle that? Probably not necessary as video is more jarring. * Make VP8 Key Frame a const * Need a packet factory buffer for simple tracks too as we are using the VP8 munger for simple tracks too because of the need to send blank frames at the end. Also, making the writeBlankFrameRTP a private function. And adding a check to not send blank frames if nothing has been sent on that DownTrack.