Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 09 Apr 2016 20:38:45 +0200
changeset 292656 bd4c7118ebb957763b7d957ca73b7fba6cf61265
parent 292655 532a99cadead9024d6a2ad7715d81016e8f5949e
child 292657 1e038d4d718fa1b758147b7d9f32072fe9bfe1cd
push id30166
push usercbook@mozilla.com
push dateTue, 12 Apr 2016 11:50:35 +0000
treeherdermozilla-central@49d7fb650c9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1263334
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin MozReview-Commit-ID: KPrn5WeXUuF
dom/media/MP3Demuxer.cpp
--- a/dom/media/MP3Demuxer.cpp
+++ b/dom/media/MP3Demuxer.cpp
@@ -342,17 +342,17 @@ MP3TrackDemuxer::StreamLength() const {
 TimeUnit
 MP3TrackDemuxer::Duration() const {
   if (!mNumParsedFrames) {
     return TimeUnit::FromMicroseconds(-1);
   }
 
   int64_t numFrames = 0;
   const auto numAudioFrames = mParser.VBRInfo().NumAudioFrames();
-  if (numAudioFrames) {
+  if (mParser.VBRInfo().IsValid()) {
     // VBR headers don't include the VBR header frame.
     numFrames = numAudioFrames.value() + 1;
   } else {
     const int64_t streamLen = StreamLength();
     if (streamLen < 0) {
       // Unknown length, we can't estimate duration.
       return TimeUnit::FromMicroseconds(-1);
     }