Bug 1263334 - Check VBR header is valid before using it for duration calculations. r=esawin draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 09 Apr 2016 20:38:45 +0200
changeset 349183 45898c731b472879b8323ef8cba851b31feb94c2
parent 349181 25c3b46ed101c4f423d40cd802eea282e239ecf3
child 518029 aed2168566a1fea173a8eae63f3bc6bf1e9cf6b0
push id15011
push usermozilla@buttercookie.de
push dateSat, 09 Apr 2016 18:54:24 +0000
reviewersesawin
bugs1263334
milestone48.0a1
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);
     }