mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
cleanup
This commit is contained in:
@@ -664,18 +664,14 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
|
|||||||
ss.setuppedProtocol = &inTH.Protocol
|
ss.setuppedProtocol = &inTH.Protocol
|
||||||
ss.setuppedDelivery = &delivery
|
ss.setuppedDelivery = &delivery
|
||||||
|
|
||||||
if ss.setuppedTracks == nil {
|
|
||||||
ss.setuppedTracks = make(map[int]ServerSessionSetuppedTrack)
|
|
||||||
}
|
|
||||||
|
|
||||||
if res.Header == nil {
|
if res.Header == nil {
|
||||||
res.Header = make(base.Header)
|
res.Header = make(base.Header)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sst := ServerSessionSetuppedTrack{}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case delivery == base.StreamDeliveryMulticast:
|
case delivery == base.StreamDeliveryMulticast:
|
||||||
ss.setuppedTracks[trackID] = ServerSessionSetuppedTrack{}
|
|
||||||
|
|
||||||
th.Protocol = base.StreamProtocolUDP
|
th.Protocol = base.StreamProtocolUDP
|
||||||
de := base.StreamDeliveryMulticast
|
de := base.StreamDeliveryMulticast
|
||||||
th.Delivery = &de
|
th.Delivery = &de
|
||||||
@@ -689,10 +685,8 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
|
|||||||
}
|
}
|
||||||
|
|
||||||
case inTH.Protocol == base.StreamProtocolUDP:
|
case inTH.Protocol == base.StreamProtocolUDP:
|
||||||
ss.setuppedTracks[trackID] = ServerSessionSetuppedTrack{
|
sst.udpRTPPort = inTH.ClientPorts[0]
|
||||||
udpRTPPort: inTH.ClientPorts[0],
|
sst.udpRTCPPort = inTH.ClientPorts[1]
|
||||||
udpRTCPPort: inTH.ClientPorts[1],
|
|
||||||
}
|
|
||||||
|
|
||||||
th.Protocol = base.StreamProtocolUDP
|
th.Protocol = base.StreamProtocolUDP
|
||||||
de := base.StreamDeliveryUnicast
|
de := base.StreamDeliveryUnicast
|
||||||
@@ -701,9 +695,7 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
|
|||||||
th.ServerPorts = &[2]int{sc.s.udpRTPListener.port(), sc.s.udpRTCPListener.port()}
|
th.ServerPorts = &[2]int{sc.s.udpRTPListener.port(), sc.s.udpRTCPListener.port()}
|
||||||
|
|
||||||
default: // TCP
|
default: // TCP
|
||||||
ss.setuppedTracks[trackID] = ServerSessionSetuppedTrack{
|
sst.tcpChannel = inTH.InterleavedIDs[0]
|
||||||
tcpChannel: inTH.InterleavedIDs[0],
|
|
||||||
}
|
|
||||||
|
|
||||||
if ss.setuppedTracksByChannel == nil {
|
if ss.setuppedTracksByChannel == nil {
|
||||||
ss.setuppedTracksByChannel = make(map[int]int)
|
ss.setuppedTracksByChannel = make(map[int]int)
|
||||||
@@ -717,6 +709,12 @@ func (ss *ServerSession) handleRequest(sc *ServerConn, req *base.Request) (*base
|
|||||||
th.InterleavedIDs = inTH.InterleavedIDs
|
th.InterleavedIDs = inTH.InterleavedIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ss.setuppedTracks == nil {
|
||||||
|
ss.setuppedTracks = make(map[int]ServerSessionSetuppedTrack)
|
||||||
|
}
|
||||||
|
|
||||||
|
ss.setuppedTracks[trackID] = sst
|
||||||
|
|
||||||
res.Header["Transport"] = th.Write()
|
res.Header["Transport"] = th.Write()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user