Prevent sigsegv when no video exist in the file

This commit is contained in:
Zoe Roux 2024-02-18 01:30:56 +01:00
parent 20bf6851c0
commit 7f6721147a

View File

@ -152,6 +152,7 @@ func (fs *FileStream) Destroy() {
func (fs *FileStream) GetMaster() string {
master := "#EXTM3U\n"
// TODO: also check if the codec is valid in a hls before putting transmux
if fs.Info.Video != nil {
if fs.CanTransmux {
master += "#EXT-X-STREAM-INF:"
master += fmt.Sprintf("AVERAGE-BANDWIDTH=%d,", fs.Info.Video.Bitrate)
@ -174,6 +175,7 @@ func (fs *FileStream) GetMaster() string {
master += fmt.Sprintf("./%s/index.m3u8\n", quality)
}
}
}
for _, audio := range fs.Info.Audios {
master += "#EXT-X-MEDIA:TYPE=AUDIO,"
master += "GROUP-ID=\"audio\","