From 9ba761298d96867d1c4f7448fd57daad3bbb5550 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Fri, 12 Nov 2021 16:45:49 +0100 Subject: [PATCH] remove StreamType --- client.go | 8 ++++---- clientudpl.go | 4 ++-- streamtype.go | 25 ------------------------- streamtype_test.go | 12 ------------ 4 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 streamtype.go delete mode 100644 streamtype_test.go diff --git a/client.go b/client.go index 84e9ca74..471c511b 100644 --- a/client.go +++ b/client.go @@ -1438,7 +1438,7 @@ func (c *Client) doSetup( rtpListener.remotePort = thRes.ServerPorts[0] } rtpListener.trackID = trackID - rtpListener.streamType = StreamTypeRTP + rtpListener.isRTP = true cct.udpRTPListener = rtpListener rtcpListener.remoteReadIP = c.nconn.RemoteAddr().(*net.TCPAddr).IP @@ -1448,7 +1448,7 @@ func (c *Client) doSetup( rtcpListener.remotePort = thRes.ServerPorts[1] } rtcpListener.trackID = trackID - rtcpListener.streamType = StreamTypeRTCP + rtcpListener.isRTP = false cct.udpRTCPListener = rtcpListener case TransportUDPMulticast: @@ -1457,7 +1457,7 @@ func (c *Client) doSetup( rtpListener.remoteZone = "" rtpListener.remotePort = thRes.Ports[0] rtpListener.trackID = trackID - rtpListener.streamType = StreamTypeRTP + rtpListener.isRTP = true cct.udpRTPListener = rtpListener rtcpListener.remoteReadIP = c.nconn.RemoteAddr().(*net.TCPAddr).IP @@ -1465,7 +1465,7 @@ func (c *Client) doSetup( rtcpListener.remoteZone = "" rtcpListener.remotePort = thRes.Ports[1] rtcpListener.trackID = trackID - rtcpListener.streamType = StreamTypeRTCP + rtcpListener.isRTP = false cct.udpRTCPListener = rtcpListener case TransportTCP: diff --git a/clientudpl.go b/clientudpl.go index bff4f2c0..4f3dd09e 100644 --- a/clientudpl.go +++ b/clientudpl.go @@ -36,7 +36,7 @@ type clientUDPListener struct { remoteZone string remotePort int trackID int - streamType StreamType + isRTP bool running bool frameBuffer *multibuffer.MultiBuffer lastFrameTime *int64 @@ -167,7 +167,7 @@ func (l *clientUDPListener) run() { now := time.Now() atomic.StoreInt64(l.lastFrameTime, now.Unix()) - if l.streamType == StreamTypeRTP { + if l.isRTP { l.c.tracks[l.trackID].rtcpReceiver.ProcessPacketRTP(now, buf[:n]) l.c.OnPacketRTP(l.c, l.trackID, buf[:n]) } else { diff --git a/streamtype.go b/streamtype.go deleted file mode 100644 index 18600226..00000000 --- a/streamtype.go +++ /dev/null @@ -1,25 +0,0 @@ -package gortsplib - -// StreamType is a stream type. -type StreamType int - -const ( - // StreamTypeRTP means that the stream contains RTP packets - StreamTypeRTP StreamType = iota - - // StreamTypeRTCP means that the stream contains RTCP packets - StreamTypeRTCP -) - -var streamTypeLabels = map[StreamType]string{ - StreamTypeRTP: "RTP", - StreamTypeRTCP: "RTCP", -} - -// String implements fmt.Stringer -func (st StreamType) String() string { - if l, ok := streamTypeLabels[st]; ok { - return l - } - return "unknown" -} diff --git a/streamtype_test.go b/streamtype_test.go deleted file mode 100644 index d72c4cb5..00000000 --- a/streamtype_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package gortsplib - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestStreamType(t *testing.T) { - require.NotEqual(t, "unknown", StreamTypeRTP.String()) - require.Equal(t, "unknown", StreamType(4).String()) -}