summaryrefslogtreecommitdiff
path: root/dom/media
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-05-10 15:00:03 +0200
committerGitHub <noreply@github.com>2020-05-10 15:00:03 +0200
commit1659e69dfb075975f366b1e2dbfa145febb2094f (patch)
treeacbc838c88531c50dcb8ba0b2cf0213557c4c6dd /dom/media
parent42c1fcaaed006e95699d40019f568e67c749906f (diff)
parentbc4dacf690851ad180a1abe1efdd1ee890fcc5da (diff)
downloaduxp-1659e69dfb075975f366b1e2dbfa145febb2094f.tar.gz
Merge pull request #1541 from athenian200/mp3-parser-fix
Stop MP3 demuxer from choking on very small files.
Diffstat (limited to 'dom/media')
-rw-r--r--dom/media/mp3/MP3Demuxer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/dom/media/mp3/MP3Demuxer.cpp b/dom/media/mp3/MP3Demuxer.cpp
index 5a98cabfed..ccc515afb4 100644
--- a/dom/media/mp3/MP3Demuxer.cpp
+++ b/dom/media/mp3/MP3Demuxer.cpp
@@ -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;