|
|
|
@ -119,21 +119,6 @@ func (m *muxerTSGenerator) writeH264(pts time.Duration, nalus [][]byte) error { |
|
|
|
{byte(h264.NALUTypeAccessUnitDelimiter), 240}, |
|
|
|
{byte(h264.NALUTypeAccessUnitDelimiter), 240}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for _, nalu := range nalus { |
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
filteredNALUs = append(filteredNALUs, m.videoTrack.SPS(), m.videoTrack.PPS()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filteredNALUs = append(filteredNALUs, nalu) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enc, err := h264.EncodeAnnexB(filteredNALUs) |
|
|
|
enc, err := h264.EncodeAnnexB(filteredNALUs) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if m.currentSegment.buf.Len() > 0 { |
|
|
|
if m.currentSegment.buf.Len() > 0 { |
|
|
|
|