mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
simplify example
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user