Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin, a=lizzard
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 09 Apr 2016 20:38:45 +0200
changeset 323916 19f7428b8d987e557f1fa54b5b2463a7b4d9d165
parent 323915 f04cf5bb543f1974c501d3600361dcc9656bd326
child 323917 10dae46aa232edf234caf6315e3c743ccc49f304
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin, lizzard
bugs1263334
milestone47.0a2
Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin, a=lizzard 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);
     }