From e5daab6357a1333371f5b654506d4eb6aa0dcfef Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Mon, 5 Oct 2020 21:39:55 +0200 Subject: [PATCH] sourcertmp: fix frame dropping --- sourcertmp.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sourcertmp.go b/sourcertmp.go index f92cfcfd..e8afa0e9 100644 --- a/sourcertmp.go +++ b/sourcertmp.go @@ -256,7 +256,6 @@ func (s *sourceRtmp) runInnerInner() bool { readDone := make(chan error) go func() { - for { pkt, err := conn.ReadPacket() if err != nil { @@ -279,7 +278,7 @@ func (s *sourceRtmp) runInnerInner() bool { } // encode into RTP/H264 format - frames, err := h264Encoder.Write(nalus, pkt.Time) + frames, err := h264Encoder.Write(nalus, pkt.Time+pkt.CTime) if err != nil { readDone <- err return @@ -295,7 +294,7 @@ func (s *sourceRtmp) runInnerInner() bool { return } - frames, err := aacEncoder.Write(pkt.Data, pkt.Time) + frames, err := aacEncoder.Write(pkt.Data, pkt.Time+pkt.CTime) if err != nil { readDone <- err return