From ddafca5780a5516771a44c20b45c6cf1ae66fc17 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 3 Jan 2021 13:45:46 +0100 Subject: [PATCH] Decrease keyframe interval when writing to disk. --- diskwriter/diskwriter.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/diskwriter/diskwriter.go b/diskwriter/diskwriter.go index a28b19b..12a82aa 100644 --- a/diskwriter/diskwriter.go +++ b/diskwriter/diskwriter.go @@ -359,10 +359,9 @@ func (t *diskTrack) WriteRTP(packet *rtp.Packet) error { } t.lastKf = ts } else if t.writer != nil { - // Request a keyframe every 10s + // Request a keyframe every 4s delta := ts - t.lastKf - if (delta&0x80000000) == 0 && - delta > 10*90000 { + if (delta&0x80000000) != 0 || delta > 4*90000 { kfNeeded = true } }