From d5a26a98ff60cdb1951f3532d26190b746b29e49 Mon Sep 17 00:00:00 2001 From: saxon Date: Fri, 8 Feb 2019 20:20:19 +1030 Subject: [PATCH] stream/rtp/encoder.go: more sensible use of encoder buffer --- stream/rtp/encoder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stream/rtp/encoder.go b/stream/rtp/encoder.go index 20df9434..329a24c0 100644 --- a/stream/rtp/encoder.go +++ b/stream/rtp/encoder.go @@ -73,8 +73,8 @@ func NewEncoder(dst io.Writer, fps int) *Encoder { func (e *Encoder) Write(data []byte) (int, error) { e.buffer = append(e.buffer, data...) for len(e.buffer) >= sendLen { - e.Encode(e.buffer[:sendLen]) - e.buffer = e.buffer[sendLen:] + e.Encode(e.buffer) + e.buffer = e.buffer[:0] } return len(data), nil }