From e4217cd9da7cd396a7e90437ef837dbd30515c51 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Fri, 7 Aug 2020 11:32:01 +0200 Subject: [PATCH] decrease tcp read buffer size --- conn-client.go | 3 ++- examples/client-tcp.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conn-client.go b/conn-client.go index 7c3b92ff..46fc021c 100644 --- a/conn-client.go +++ b/conn-client.go @@ -25,6 +25,7 @@ const ( clientReceiverReportPeriod = 10 * time.Second clientUdpCheckStreamPeriod = 5 * time.Second clientUdpKeepalivePeriod = 30 * time.Second + clientTcpReadBufferSize = 128 * 1024 ) // Track is a track available in a certain URL. @@ -491,7 +492,7 @@ func (c *ConnClient) Play(u *url.URL) (*Response, error) { res, err := func() (*Response, error) { frame := &InterleavedFrame{ - Content: make([]byte, 0, 512*1024), + Content: make([]byte, 0, clientTcpReadBufferSize), } // v4lrtspserver sends frames before the response. diff --git a/examples/client-tcp.go b/examples/client-tcp.go index 53a64634..50dd2fc6 100644 --- a/examples/client-tcp.go +++ b/examples/client-tcp.go @@ -43,7 +43,7 @@ func main() { panic(err) } - frame := &gortsplib.InterleavedFrame{Content: make([]byte, 0, 512*1024)} + frame := &gortsplib.InterleavedFrame{Content: make([]byte, 0, 128*1024)} for { frame.Content = frame.Content[:cap(frame.Content)]