From 37b8e7a8bcdc92fa7b35794b1c173413b0d98a40 Mon Sep 17 00:00:00 2001 From: Saxon Milton Date: Fri, 23 Aug 2019 06:11:54 +0000 Subject: [PATCH] revid: increase sender ring buffer read timeouts to slow down output loops --- revid/senders.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 7de06342..303663ec 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -50,6 +50,12 @@ import ( // Log is used by the multiSender. type Log func(level int8, message string, params ...interface{}) +// Sender ring buffer read timeouts. +const ( + rtmpRBReadTimeout = 1 * time.Second + mtsRBReadTimeout = 1 * time.Second +) + // httpSender provides an implemntation of io.Writer to perform sends to a http // destination. type httpSender struct { @@ -192,7 +198,7 @@ func (s *mtsSender) output() { // If chunk is nil then we're ready to get another from the ringBuffer. if chunk == nil { var err error - chunk, err = s.ring.Next(0) + chunk, err = s.ring.Next(mtsRBReadTimeout) switch err { case nil, io.EOF: continue @@ -301,7 +307,7 @@ func (s *rtmpSender) output() { // If chunk is nil then we're ready to get another from the ring buffer. if chunk == nil { var err error - chunk, err = s.ring.Next(0) + chunk, err = s.ring.Next(rtmpRBReadTimeout) switch err { case nil, io.EOF: continue