多slice的情况下,同步同一帧的时间戳

`vpacketer.Packetize`再打包的过程中会把当前的timestamp+samples作为下一次打包的时间戳,如果多slice会连续传递samples导致同一帧的时间戳不一致
This commit is contained in:
訾明华
2022-01-11 11:34:29 +08:00
committed by GitHub
parent f110513d70
commit db07f0d588

View File

@@ -98,7 +98,13 @@ func (sh *RTSPServer) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*ba
var st uint32
onVideo := func(ts uint32, pack *engine.VideoPack) {
for i, nalu := range pack.NALUs {
packs := vpacketer.Packetize(nalu, (ts-st)*90)
var samples uint32
if i == len(pack.NALUs)-1 {
samples = (ts-st)*90
} else {
samples = 0
}
packs := vpacketer.Packetize(nalu, samples)
for j, rtpack := range packs {
rtpack.Marker = i == len(pack.NALUs)-1 && j == len(packs)-1
rtp, _ := rtpack.Marshal()