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 { for _, nalu := range nalus {
// remove existing SPS, PPS, AUD
typ := h264.NALUType(nalu[0] & 0x1F) typ := h264.NALUType(nalu[0] & 0x1F)
switch typ { switch typ {
case h264.NALUTypeSPS, h264.NALUTypePPS, h264.NALUTypeAccessUnitDelimiter: case h264.NALUTypeSPS, h264.NALUTypePPS, h264.NALUTypeAccessUnitDelimiter:
// remove existing SPS, PPS, AUD
continue continue
}
// add SPS and PPS before every IDR case h264.NALUTypeIDR:
if typ == h264.NALUTypeIDR { // add SPS and PPS before every IDR
filteredNALUs = append(filteredNALUs, e.h264Conf.SPS, e.h264Conf.PPS) filteredNALUs = append(filteredNALUs, e.h264Conf.SPS, e.h264Conf.PPS)
} }