Bug 1363647 - reduce MIN_SUCCESSIVE_FRAMES to 3 for a very short mp3 file. r?JanH
MozReview-Commit-ID: LwO9aMglPNP
--- a/dom/media/MP3Demuxer.cpp
+++ b/dom/media/MP3Demuxer.cpp
@@ -415,17 +415,19 @@ MP3TrackDemuxer::Duration(int64_t aNumFr
const double usPerFrame = USECS_PER_S * mSamplesPerFrame / mSamplesPerSecond;
return TimeUnit::FromMicroseconds(aNumFrames * usPerFrame);
}
MediaByteRange
MP3TrackDemuxer::FindFirstFrame()
{
- static const int MIN_SUCCESSIVE_FRAMES = 4;
+ // Get engough successive frames to avoid invalid frame from cut stream.
+ // However, some website use very short mp3 file so using the same value as Chrome.
+ static const int MIN_SUCCESSIVE_FRAMES = 3;
MediaByteRange candidateFrame = FindNextFrame();
int numSuccFrames = candidateFrame.Length() > 0;
MediaByteRange currentFrame = candidateFrame;
MP3LOGV("FindFirst() first candidate frame: mOffset=%" PRIu64
" Length()=%" PRIu64,
candidateFrame.mStart, candidateFrame.Length());
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -79,16 +79,17 @@ var gProgressTests = [
// Used by test_played.html
var gPlayedTests = [
{ name:"big-short.wav", type:"audio/x-wav", duration:1.11 },
{ name:"seek-short.ogv", type:"video/ogg", duration:1.03 },
{ name:"seek-short.webm", type:"video/webm", duration:0.23 },
{ name:"gizmo-short.mp4", type:"video/mp4", duration:0.27 },
{ name:"owl-short.mp3", type:"audio/mpeg", duration:0.52 },
+ { name:"very-short.mp3", type:"audio/mpeg", duration:0.07 },
// Disable vbr.mp3 to see if it reduces the error of AUDCLNT_E_CPUUSAGE_EXCEEDED.
// See bug 1110922 comment 26.
//{ name:"vbr.mp3", type:"audio/mpeg", duration:10.0 },
{ name:"bug495794.ogg", type:"audio/ogg", duration:0.3 },
];
// Used by test_mozLoadFrom. Need one test file per decoder backend, plus
// anything for testing clone-specific bugs.
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -601,16 +601,17 @@ support-files =
variable-samplerate.ogg
variable-samplerate.ogg^headers^
variable-samplerate.opus
variable-samplerate.opus^headers^
vbr-head.mp3
vbr-head.mp3^headers^
vbr.mp3
vbr.mp3^headers^
+ very-short.mp3
video-overhang.ogg
video-overhang.ogg^headers^
vp9.webm
vp9.webm^headers^
vp9-short.webm
vp9-short.webm^headers^
vp9cake.webm
vp9cake.webm^headers^
new file mode 100644
index 0000000000000000000000000000000000000000..1d15dcad599ed86e6022d4b02121c6147532e1d2
GIT binary patch
literal 625
zc%1wHdqN5W0T7Xymky-(ftU%13K<$m1^-C~K)Y;w9DQAl^(-xlSk}XwVxpkJw!xQy
z@eIfvZQ3i$3Aug9ga5w;Tp0L2Ffi0NFfed1fSHUy^baVfz`$UCfPsMp7EpRdp=1M~
dJt;~c!!sGc_V6k|>{$Y_#{_6Q3;Cua001>^kURhY