b=967924 correct resampler input buffer sample count estimate math r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 06 Feb 2014 08:15:31 +1300
changeset 178128 5282b4fa4cea935add054c75a09d32e6d29b741a
parent 178127 7d24d7dfbb530bf042b4c75265b0b79e4b5249b2
child 178129 3eb7ea1fb2d7c48cad80de182668a8a9b87d950b
push id5439
push userffxbld
push dateMon, 17 Mar 2014 23:08:15 +0000
treeherdermozilla-aurora@c0befb3c8038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs967924
milestone30.0a1
b=967924 correct resampler input buffer sample count estimate math r=padenot
content/media/webaudio/AudioBufferSourceNode.cpp
--- a/content/media/webaudio/AudioBufferSourceNode.cpp
+++ b/content/media/webaudio/AudioBufferSourceNode.cpp
@@ -198,17 +198,17 @@ public:
       uint32_t availableInInputBuffer = aBufferMax - aBufferOffset;
       // Limit the number of input samples copied and possibly
       // format-converted for resampling by estimating how many will be used.
       // This may be a little small when filling the resampler with initial
       // data, but we'll get called again and it will work out.
       uint32_t num, den;
       speex_resampler_get_ratio(resampler, &num, &den);
       uint32_t inputLimit = std::min(availableInInputBuffer,
-                                     availableInOutputBuffer * den / num + 10);
+                                     availableInOutputBuffer * num / den + 10);
       for (uint32_t i = 0; true; ) {
         uint32_t inSamples = inputLimit;
         const float* inputData = mBuffer->GetData(i) + aBufferOffset;
 
         uint32_t outSamples = availableInOutputBuffer;
         float* outputData =
           static_cast<float*>(const_cast<void*>(aOutput->mChannelData[i])) +
           aOffsetWithinBlock;