Bug 1364834 - Fix rounding error in WaveDataDecoder::ProcessDecode(). r=jya
authorJW Wang <jwwang@mozilla.com>
Mon, 15 May 2017 17:25:26 +0800
changeset 406621 b822eb070c1118012bd96e575cfee8abf5354311
parent 406620 471b374af5aba226c603bc9e1bad08b907ab214e
child 406622 5e10a4052ff879eaec620f3aad8d133d48696480
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1364834
milestone55.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 1364834 - Fix rounding error in WaveDataDecoder::ProcessDecode(). r=jya The duration is rounded down to 0 if |frames| is smaller than |mInfo.mRate|. We should call FramesToTimeUnit() instead. MozReview-Commit-ID: E7eOQuD48x2
dom/media/platforms/agnostic/WAVDecoder.cpp
--- a/dom/media/platforms/agnostic/WAVDecoder.cpp
+++ b/dom/media/platforms/agnostic/WAVDecoder.cpp
@@ -112,17 +112,17 @@ WaveDataDecoder::ProcessDecode(MediaRawD
           int32_t v = aReader.ReadLE24();
           buffer[i * mInfo.mChannels + j] =
               Int24bitToAudioSample<AudioDataValue>(v);
         }
       }
     }
   }
 
-  auto duration = media::TimeUnit::FromMicroseconds(frames / mInfo.mRate);
+  auto duration = FramesToTimeUnit(frames, mInfo.mRate);
 
   return DecodePromise::CreateAndResolve(
     DecodedData{ new AudioData(aOffset, aSample->mTime, duration, frames,
                                Move(buffer), mInfo.mChannels, mInfo.mRate) },
     __func__);
 }
 
 RefPtr<MediaDataDecoder::DecodePromise>