Stop MP3 demuxer from choking on very small files.

master
Fedor 2020-06-10 21:11:34 +03:00
parent 77d40cb484
commit 1d760290a6
1 changed files with 4 additions and 1 deletions

View File

@ -396,7 +396,10 @@ MP3TrackDemuxer::Duration(int64_t aNumFrames) const {
MediaByteRange
MP3TrackDemuxer::FindFirstFrame() {
static const int MIN_SUCCESSIVE_FRAMES = 4;
// This check is meant to avoid invalid frames from broken streams, but
// small MP3 files and streams with odd header data can break this. Lowering
// the value to 3 seems to help significantly.
static const int MIN_SUCCESSIVE_FRAMES = 3;
MediaByteRange candidateFrame = FindNextFrame();
int numSuccFrames = candidateFrame.Length() > 0;