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:
aler9
2022-12-19 13:46:43 +01:00
parent b3de3cf80e
commit ffe8c87c38
9 changed files with 305 additions and 285 deletions

View File

@@ -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)
}