mirror of
https://github.com/aler9/gortsplib
synced 2025-10-11 01:50:30 +08:00
add ConnClient.Tracks(); remove Tracks from DialRead returned values
This commit is contained in:
@@ -86,6 +86,7 @@ type ConnClient struct {
|
||||
state connClientState
|
||||
streamUrl *url.URL
|
||||
streamProtocol *StreamProtocol
|
||||
tracks map[int]*Track
|
||||
rtcpReceivers map[int]*rtcpreceiver.RtcpReceiver
|
||||
udpLastFrameTimes map[int]*int64
|
||||
udpRtpListeners map[int]*connClientUDPListener
|
||||
@@ -131,6 +132,7 @@ func NewConnClient(conf ConnClientConf) (*ConnClient, error) {
|
||||
conf: conf,
|
||||
br: bufio.NewReaderSize(conf.Conn, clientReadBufferSize),
|
||||
bw: bufio.NewWriterSize(conf.Conn, clientWriteBufferSize),
|
||||
tracks: make(map[int]*Track),
|
||||
rtcpReceivers: make(map[int]*rtcpreceiver.RtcpReceiver),
|
||||
udpLastFrameTimes: make(map[int]*int64),
|
||||
udpRtpListeners: make(map[int]*connClientUDPListener),
|
||||
@@ -184,6 +186,11 @@ func (c *ConnClient) NetConn() net.Conn {
|
||||
return c.conf.Conn
|
||||
}
|
||||
|
||||
// Tracks returns all the tracks passed to SetupUDP() or SetupTCP().
|
||||
func (c *ConnClient) Tracks() map[int]*Track {
|
||||
return c.tracks
|
||||
}
|
||||
|
||||
func (c *ConnClient) readFrameTCPOrResponse() (interface{}, error) {
|
||||
frame := c.tcpFrames.next()
|
||||
|
||||
@@ -579,6 +586,8 @@ func (c *ConnClient) SetupUDP(u *url.URL, mode TransportMode, track *Track, rtpP
|
||||
streamProtocol := StreamProtocolUDP
|
||||
c.streamProtocol = &streamProtocol
|
||||
|
||||
c.tracks[track.Id] = track
|
||||
|
||||
if mode == TransportModePlay {
|
||||
c.rtcpReceivers[track.Id] = rtcpreceiver.New()
|
||||
|
||||
@@ -643,6 +652,8 @@ func (c *ConnClient) SetupTCP(u *url.URL, mode TransportMode, track *Track) (*ba
|
||||
streamProtocol := StreamProtocolTCP
|
||||
c.streamProtocol = &streamProtocol
|
||||
|
||||
c.tracks[track.Id] = track
|
||||
|
||||
if mode == TransportModePlay {
|
||||
c.rtcpReceivers[track.Id] = rtcpreceiver.New()
|
||||
}
|
||||
|
Reference in New Issue
Block a user