From ce2047715f7bb0ca51b7142ab1b1c27097b25637 Mon Sep 17 00:00:00 2001 From: Quanqi Gu Date: Thu, 14 Oct 2021 17:17:32 +0800 Subject: [PATCH] Fix frequent refresh/freezing of rtmp stream --- format/rtmp/rtmp.go | 4 ++-- utils/bits/pio/pio.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/format/rtmp/rtmp.go b/format/rtmp/rtmp.go index 449132e..480e8d4 100644 --- a/format/rtmp/rtmp.go +++ b/format/rtmp/rtmp.go @@ -201,8 +201,8 @@ func NewConn(netconn net.Conn) *Conn { conn.bufr = bufio.NewReaderSize(netconn, pio.RecommendBufioSize) conn.bufw = bufio.NewWriterSize(netconn, pio.RecommendBufioSize) conn.txrxcount = &txrxcount{ReadWriter: netconn} - conn.writebuf = make([]byte, 4096) - conn.readbuf = make([]byte, 4096) + conn.writebuf = make([]byte, 256) + conn.readbuf = make([]byte, 256) conn.chunkHeaderBuf = make([]byte, 265) conn.chunkHeaderBufExt = make([]byte, 12+4+4) return conn diff --git a/utils/bits/pio/pio.go b/utils/bits/pio/pio.go index 3d56bef..501dce6 100644 --- a/utils/bits/pio/pio.go +++ b/utils/bits/pio/pio.go @@ -1,5 +1,3 @@ - package pio -var RecommendBufioSize = 1024*64 - +var RecommendBufioSize = 128