client: fix support for ReadBufferCount > 1

This commit is contained in:
aler9
2022-03-07 22:36:19 +01:00
parent b399656856
commit 94aaa6719d
4 changed files with 67 additions and 64 deletions

24
rtppacketmultibuffer.go Normal file
View File

@@ -0,0 +1,24 @@
package gortsplib
import (
"github.com/pion/rtp"
)
type rtpPacketMultiBuffer struct {
count uint64
buffers []rtp.Packet
cur uint64
}
func newRTPPacketMultiBuffer(count uint64) *rtpPacketMultiBuffer {
return &rtpPacketMultiBuffer{
count: count,
buffers: make([]rtp.Packet, count),
}
}
func (mb *rtpPacketMultiBuffer) next() *rtp.Packet {
ret := &mb.buffers[mb.cur%mb.count]
mb.cur++
return ret
}