mirror of
https://github.com/aler9/gortsplib
synced 2025-09-27 03:25:52 +08:00
server: fix race condition (#178)
This commit is contained in:
@@ -50,6 +50,12 @@ func newServerSessionMedia(ss *ServerSession, medi *media.Media) *serverSessionM
|
||||
}
|
||||
|
||||
func (sm *serverSessionMedia) start() {
|
||||
// allocate udpRTCPReceiver before udpRTCPListener
|
||||
// otherwise udpRTCPReceiver.LastSSRC() can't be called.
|
||||
for _, sf := range sm.formats {
|
||||
sf.start()
|
||||
}
|
||||
|
||||
switch *sm.ss.setuppedTransport {
|
||||
case TransportUDP, TransportUDPMulticast:
|
||||
sm.writePacketRTPInQueue = sm.writePacketRTPInQueueUDP
|
||||
@@ -94,10 +100,6 @@ func (sm *serverSessionMedia) start() {
|
||||
sm.ss.s.udpRTCPListener.addClient(sm.ss.author.ip(), sm.udpRTCPReadPort, sm)
|
||||
}
|
||||
}
|
||||
|
||||
for _, sf := range sm.formats {
|
||||
sf.start()
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *serverSessionMedia) stop() {
|
||||
|
Reference in New Issue
Block a user