Bug 1068970 - Ensure MediaDecoderStateMachine::SendStreamAudio() uses UsecsToFrames correctly. r=roc
☠☠ backed out by f1fd44eebac7 ☠ ☠
authorChris Pearce <cpearce@mozilla.com>
Fri, 19 Sep 2014 15:44:24 +1200
changeset 206129 9362521b7f7a5a938bb09d8f6f6ac96b02a609dc
parent 206128 80e8680ef5cb162898050066a0e44366ac4c3192
child 206130 1674d241ce3d325eaf631fe44440d2da5886b125
push id27513
push usercbook@mozilla.com
push dateFri, 19 Sep 2014 12:15:35 +0000
treeherdermozilla-central@dadafedc0760 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1068970
milestone35.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 1068970 - Ensure MediaDecoderStateMachine::SendStreamAudio() uses UsecsToFrames correctly. r=roc
content/media/MediaDecoderStateMachine.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -295,19 +295,20 @@ void MediaDecoderStateMachine::SendStrea
     // ignore packet that we've already processed
     return;
   }
   aStream->mLastAudioPacketTime = aAudio->mTime;
   aStream->mLastAudioPacketEndTime = aAudio->GetEndTime();
 
   // This logic has to mimic AudioSink closely to make sure we write
   // the exact same silences
-  CheckedInt64 audioWrittenOffset = UsecsToFrames(mInfo.mAudio.mRate,
-      aStream->mInitialTime + mStartTime) + aStream->mAudioFramesWritten;
-  CheckedInt64 frameOffset = UsecsToFrames(mInfo.mAudio.mRate, aAudio->mTime);
+  CheckedInt64 audioWrittenOffset =
+    UsecsToFrames((aStream->mInitialTime + mStartTime) + aStream->mAudioFramesWritten,
+                  mInfo.mAudio.mRate);
+  CheckedInt64 frameOffset = UsecsToFrames(aAudio->mTime, mInfo.mAudio.mRate);
   if (!audioWrittenOffset.isValid() || !frameOffset.isValid())
     return;
   if (audioWrittenOffset.value() < frameOffset.value()) {
     // Write silence to catch up
     VERBOSE_LOG("writing %d frames of silence to MediaStream",
                 int32_t(frameOffset.value() - audioWrittenOffset.value()));
     AudioSegment silence;
     silence.InsertNullDataAtStart(frameOffset.value() - audioWrittenOffset.value());