Bug 941283 - OpusTrackEncoder should write pre-skip at the original samplerate. r=rillian
authorShelly Lin <slin@mozilla.com>
Mon, 02 Dec 2013 11:54:35 +0800
changeset 173230 539fb8b1b9e3d0a512bd2855e62bbdf516f62725
parent 173229 a1cba1f33a49fa2a120228c2d2f40712d8501a9b
child 173231 efc30ce15377d80715992055b403ec1a3a29a5e6
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs941283
milestone28.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 941283 - OpusTrackEncoder should write pre-skip at the original samplerate. r=rillian
content/media/encoder/OpusTrackEncoder.cpp
--- a/content/media/encoder/OpusTrackEncoder.cpp
+++ b/content/media/encoder/OpusTrackEncoder.cpp
@@ -207,18 +207,19 @@ OpusTrackEncoder::GetMetadata()
 
   mLookahead = 0;
   int error = opus_encoder_ctl(mEncoder, OPUS_GET_LOOKAHEAD(&mLookahead));
   if (error != OPUS_OK) {
     mLookahead = 0;
   }
 
   // The ogg time stamping and pre-skip is always timed at 48000.
-  SerializeOpusIdHeader(mChannels, mLookahead*(kOpusSamplingRate/mSamplingRate),
-                        mSamplingRate, &meta->mIdHeader);
+  SerializeOpusIdHeader(mChannels, mLookahead * (kOpusSamplingRate /
+                        GetOutputSampleRate()), mSamplingRate,
+                        &meta->mIdHeader);
 
   nsCString vendor;
   vendor.AppendASCII(opus_get_version_string());
 
   nsTArray<nsCString> comments;
   comments.AppendElement(NS_LITERAL_CSTRING("ENCODER=Mozilla" MOZ_APP_UA_VERSION));
 
   SerializeOpusCommentHeader(vendor, comments,