Return error and retry if m3u8.Playlist is nil

This commit is contained in:
YamiOdymel 2022-09-07 18:14:12 +08:00
parent aafd559ce1
commit e0614cb02c
No known key found for this signature in database
GPG Key ID: 68E469836934DB36

View File

@ -113,7 +113,10 @@ func parseM3U8Source(url string) (chunks []*m3u8.MediaSegment, wait float64, err
// Decode the segment table.
p, _, _ := m3u8.DecodeFrom(strings.NewReader(body), true)
media := p.(*m3u8.MediaPlaylist)
media, ok := p.(*m3u8.MediaPlaylist)
if !ok {
return nil, 3, errInternal
}
wait = media.TargetDuration / 1.5
// Ignore the empty segments.