Bug 1409272 - P2. Pre-roll vorbis by 80ms when seeking. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 17 Oct 2017 16:07:26 +0200
changeset 681624 a99a9f21d891dcdecbf02d0439e15cbff37605bf
parent 681623 1408522bc2f912911909d722db6cd499c61b7221
child 736188 eacb3e3e88207f3f0a8d26072897f45ef3363642
push id84874
push userbmo:jyavenard@mozilla.com
push dateTue, 17 Oct 2017 14:09:11 +0000
reviewersgerald
bugs1409272
milestone58.0a1
Bug 1409272 - P2. Pre-roll vorbis by 80ms when seeking. r?gerald The value by which we pre-roll is inconsequential, so long as we seek to the previous packet than the one we want. So 80ms will do. MozReview-Commit-ID: 8iPOtjReZnb
dom/media/mediasource/MediaSourceDemuxer.cpp
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MediaSourceDemuxer.h"
 
 #include "MediaSourceUtils.h"
 #include "OpusDecoder.h"
 #include "SourceBufferList.h"
+#include "VorbisDecoder.h"
 #include "nsPrintfCString.h"
 
 #include <algorithm>
 #include <limits>
 #include <stdint.h>
 
 namespace mozilla {
 
@@ -302,17 +303,18 @@ MediaSourceTrackDemuxer::MediaSourceTrac
                                                  TrackInfo::TrackType aType,
                                                  TrackBuffersManager* aManager)
   : mParent(aParent)
   , mManager(aManager)
   , mType(aType)
   , mMonitor("MediaSourceTrackDemuxer")
   , mReset(true)
   , mPreRoll(TimeUnit::FromMicroseconds(
-      OpusDataDecoder::IsOpus(mParent->GetTrackInfo(mType)->mMimeType)
+      OpusDataDecoder::IsOpus(mParent->GetTrackInfo(mType)->mMimeType) ||
+      VorbisDataDecoder::IsVorbis(mParent->GetTrackInfo(mType)->mMimeType)
       ? 80000
       : mParent->GetTrackInfo(mType)->mMimeType.EqualsLiteral("audio/mp4a-latm")
         // AAC encoder delay is by default 2112 audio frames.
         // See https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
         // So we always seek 2112 frames
         ? (2112 * 1000000ULL
            / mParent->GetTrackInfo(mType)->GetAsAudioInfo()->mRate)
         : 0))