simplify example

This commit is contained in:
aler9
2021-12-12 23:06:41 +01:00
parent 165b347090
commit bee47726fa

View File

@@ -78,15 +78,15 @@ func (e *mpegtsEncoder) encode(nalus [][]byte, pts time.Duration) error {
}
for _, nalu := range nalus {
// remove existing SPS, PPS, AUD
typ := h264.NALUType(nalu[0] & 0x1F)
switch typ {
case h264.NALUTypeSPS, h264.NALUTypePPS, h264.NALUTypeAccessUnitDelimiter:
// remove existing SPS, PPS, AUD
continue
}
case h264.NALUTypeIDR:
// add SPS and PPS before every IDR
if typ == h264.NALUTypeIDR {
filteredNALUs = append(filteredNALUs, e.h264Conf.SPS, e.h264Conf.PPS)
}