server: parse incoming RTP/H264 packets; fix RTCP receiver jitter

This commit is contained in:
aler9
2022-03-26 16:52:46 +01:00
committed by Alessandro Ros
parent 718b084f83
commit 0463e6b510
9 changed files with 182 additions and 106 deletions

View File

@@ -62,17 +62,6 @@ func (e *mpegtsEncoder) encode(nalus [][]byte, pts time.Duration) error {
e.startPTS = pts
}
// check if there's an IDR
idrPresent := func() bool {
for _, nalu := range nalus {
typ := h264.NALUType(nalu[0] & 0x1F)
if typ == h264.NALUTypeIDR {
return true
}
}
return false
}()
// prepend an AUD. This is required by some players
filteredNALUs := [][]byte{
{byte(h264.NALUTypeAccessUnitDelimiter), 240},
@@ -131,7 +120,7 @@ func (e *mpegtsEncoder) encode(nalus [][]byte, pts time.Duration) error {
_, err = e.mux.WriteData(&astits.MuxerData{
PID: 256,
AdaptationField: &astits.PacketAdaptationField{
RandomAccessIndicator: idrPresent,
RandomAccessIndicator: h264.IDRPresent(filteredNALUs),
},
PES: &astits.PESData{
Header: &astits.PESHeader{