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

@@ -236,7 +236,6 @@ type Client struct {
medias map[*media.Media]*clientMedia
tcpMediasByChannel map[int]*clientMedia
lastRange *headers.Range
rtpPacketBuffer *rtpPacketMultiBuffer // play
checkStreamTimer *time.Timer
checkStreamInitial bool
tcpLastFrameTime *int64
@@ -630,7 +629,6 @@ func (c *Client) playRecordStart() {
if c.state == clientStatePlay {
c.keepaliveTimer = time.NewTimer(c.keepalivePeriod)
c.rtpPacketBuffer = newRTPPacketMultiBuffer(uint64(c.ReadBufferCount))
switch *c.effectiveTransport {
case TransportUDP: