Skip to content

Commit e6a7a87

Browse files
authored
Fix: gracefully handle fMP4 segments with missing or partial moof/mdat (#4538)
1 parent fff3b9b commit e6a7a87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/playback/segment_fmp4.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func segmentFMP4ReadDurationFromParts(
193193
}
194194

195195
if !bytes.Equal(buf[4:], []byte{'m', 'o', 'o', 'f'}) {
196-
return 0, fmt.Errorf("moof box not found")
196+
break
197197
}
198198

199199
moofSize := uint32(buf[0])<<24 | uint32(buf[1])<<16 | uint32(buf[2])<<8 | uint32(buf[3])
@@ -209,7 +209,7 @@ func segmentFMP4ReadDurationFromParts(
209209
}
210210

211211
if !bytes.Equal(buf[4:], []byte{'m', 'd', 'a', 't'}) {
212-
return 0, fmt.Errorf("mdat box not found")
212+
break
213213
}
214214

215215
mdatSize := uint32(buf[0])<<24 | uint32(buf[1])<<16 | uint32(buf[2])<<8 | uint32(buf[3])

0 commit comments

Comments
 (0)