hls muxer: fix crash in case of null SPS

This commit is contained in:
aler9 2022-04-14 15:29:41 +02:00
parent f71b7d8967
commit 76d4376476

View File

@ -29,7 +29,10 @@ func newMuxerPrimaryPlaylist(
var codecs []string
if p.videoTrack != nil {
codecs = append(codecs, "avc1."+hex.EncodeToString(p.videoTrack.SPS()[1:4]))
sps := p.videoTrack.SPS()
if len(sps) >= 4 {
codecs = append(codecs, "avc1."+hex.EncodeToString(sps[1:4]))
}
}
// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter