From 32e2d61ec19871775ec5382ad4c5f00cd849ddca Mon Sep 17 00:00:00 2001 From: saxon Date: Fri, 28 Dec 2018 10:31:50 +1030 Subject: [PATCH] revid: fixed rtmp problem by adding extra check of output to figure out clip duration before send --- revid/revid.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 93bcdf38..c686ece8 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -50,7 +50,7 @@ import ( // Misc constants const ( - clipDuration = 1 * time.Second + clipDuration = 1000 * time.Millisecond mp2tPacketSize = 188 // MPEG-TS packet size mp2tMaxPackets = int(clipDuration * 2016 / time.Second) // # first multiple of 7 and 8 greater than 2000 ringBufferSize = 10000 @@ -157,7 +157,7 @@ func (p *packer) Write(frame []byte) (int, error) { } p.packetCount++ now = time.Now() - if now.Sub(prevTime) > clipDuration && p.packetCount%7 == 0 { + if (p.owner.config.Output1 != Rtmp && now.Sub(prevTime) > clipDuration && p.packetCount%7 == 0) || p.owner.config.Output1 == Rtmp { p.owner.buffer.Flush() p.packetCount = 0 prevTime = now