mirror of
https://github.com/aler9/gortsplib
synced 2025-10-25 00:00:30 +08:00
remove StreamType
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
Reference in New Issue
Block a user