T4.6: SFU keyframe cache — per-(room,sender,stream) I-frame replay on join

This commit is contained in:
Siavash Sameni
2026-05-12 10:54:04 +04:00
parent cc5aef2534
commit 828fbea2ea
5 changed files with 239 additions and 12 deletions

View File

@@ -1936,9 +1936,21 @@ async fn main() -> anyhow::Result<()> {
Some(&participant_fp),
caller_alias.as_deref(),
) {
Ok((id, update, senders)) => {
Ok((id, update, senders, cached_keyframes)) => {
metrics.active_rooms.set(room_mgr.list().len() as i64);
// Replay cached keyframes to the new participant before live
// traffic starts. This eliminates black-screen-on-join when
// the cache is warm.
for kf in cached_keyframes {
for pkt in kf {
if let Err(e) = transport.send_media(&pkt).await {
warn!(%addr, participant = id, "keyframe replay send error: {e}");
break;
}
}
}
// Merge federated participants into RoomUpdate if this is a global room
let merged_update = if let Some(ref fm) = federation_mgr {
if fm.is_global_room(&room_name) {