From 300c5bc14d8b2788f6da8645f670706bdc3b73ce Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Sun, 13 Nov 2022 09:38:49 +1030 Subject: [PATCH] revid/senders.go: increase buffer pool maxAlloc in mtsSender --- revid/senders.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 3515943e..87877784 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -49,9 +49,10 @@ import ( // Sender pool buffer read timeouts. const ( - rtmpPoolReadTimeout = 1 * time.Second - mtsPoolReadTimeout = 1 * time.Second - maxBuffLen = 50000000 + rtmpPoolReadTimeout = 1 * time.Second + mtsPoolReadTimeout = 1 * time.Second + mtsBufferPoolMaxAlloc = 5 << 20 // 5MiB. + maxBuffLen = 50000000 ) var ( @@ -228,6 +229,9 @@ func newMTSSender(dst io.WriteCloser, log logging.Logger, rb *pool.Buffer, clipD done: make(chan struct{}), clipDur: clipDur, } + // mtsSender will do particularly large writes to the pool buffer; let's + // increase its max allowable allocation. + pool.MaxAlloc(mtsBufferPoolMaxAlloc) s.wg.Add(1) go s.output() return s