mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 23:02:45 +08:00
fix overriding of previously-received RTP packets that leaded to crashes
RTP packets were previously take from a buffer pool. This was messing up the Client, since that buffer pool was used by multiple routines at once, and was probably messing up the Server too, since packets can be pushed to different queues and there's no guarantee that these queues have an overall size less than ReadBufferCount. This buffer pool is removed; this decreases performance but avoids bugs.
This commit is contained in:
@@ -292,11 +292,6 @@ func (st *ServerStream) WritePacketRTPWithNTP(medi *media.Media, pkt *rtp.Packet
|
||||
|
||||
// WritePacketRTCP writes a RTCP packet to all the readers of the stream.
|
||||
func (st *ServerStream) WritePacketRTCP(medi *media.Media, pkt rtcp.Packet) {
|
||||
byts, err := pkt.Marshal()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
st.mutex.RLock()
|
||||
defer st.mutex.RUnlock()
|
||||
|
||||
@@ -305,17 +300,5 @@ func (st *ServerStream) WritePacketRTCP(medi *media.Media, pkt rtcp.Packet) {
|
||||
}
|
||||
|
||||
sm := st.streamMedias[medi]
|
||||
|
||||
// send unicast
|
||||
for r := range st.activeUnicastReaders {
|
||||
sm, ok := r.setuppedMedias[medi]
|
||||
if ok {
|
||||
sm.writePacketRTCP(byts)
|
||||
}
|
||||
}
|
||||
|
||||
// send multicast
|
||||
if sm.multicastHandler != nil {
|
||||
sm.multicastHandler.writePacketRTCP(byts)
|
||||
}
|
||||
sm.writePacketRTCP(st, pkt)
|
||||
}
|
||||
|
Reference in New Issue
Block a user