test annexB

This commit is contained in:
deepch 2022-03-13 22:18:18 +03:00
parent b13c5434c5
commit 4a535c5296

View File

@ -225,6 +225,7 @@ func (element *Muxer) WritePacket(pkt av.Packet) (err error) {
if naltype == 5 { if naltype == 5 {
codec := tmp.codec.(h264parser.CodecData) codec := tmp.codec.(h264parser.CodecData)
err = tmp.track.WriteSample(media.Sample{Data: append([]byte{0, 0, 0, 1}, bytes.Join([][]byte{codec.SPS(), codec.PPS(), nalu}, []byte{0, 0, 0, 1})...), Duration: pkt.Duration}) err = tmp.track.WriteSample(media.Sample{Data: append([]byte{0, 0, 0, 1}, bytes.Join([][]byte{codec.SPS(), codec.PPS(), nalu}, []byte{0, 0, 0, 1})...), Duration: pkt.Duration})
} else { } else {
err = tmp.track.WriteSample(media.Sample{Data: append([]byte{0, 0, 0, 1}, nalu...), Duration: pkt.Duration}) err = tmp.track.WriteSample(media.Sample{Data: append([]byte{0, 0, 0, 1}, nalu...), Duration: pkt.Duration})
} }
@ -235,12 +236,13 @@ func (element *Muxer) WritePacket(pkt av.Packet) (err error) {
WritePacketSuccess = true WritePacketSuccess = true
return return
/* /*
codec := tmp.codec.(h264parser.CodecData)
if pkt.IsKeyFrame { if pkt.IsKeyFrame {
pkt.Data = append([]byte{0, 0, 0, 1}, bytes.Join([][]byte{codec.SPS(), codec.PPS(), pkt.Data[4:]}, []byte{0, 0, 0, 1})...) pkt.Data = append([]byte{0, 0, 0, 1}, bytes.Join([][]byte{codec.SPS(), codec.PPS(), pkt.Data[4:]}, []byte{0, 0, 0, 1})...)
} else { } else {
pkt.Data = pkt.Data[4:] pkt.Data = pkt.Data[4:]
} }
*/ */
case av.PCM_ALAW: case av.PCM_ALAW:
case av.OPUS: case av.OPUS: