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
--- 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))