Bug 1265794: P1. Ensure we can always fit a complete audio frame in an audio buffer. r=rillian
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 20 Apr 2016 19:56:59 +1000
changeset 332043 b8f1a46ea42a9b2c49cbd9d0828a5fcda5d3eca7
parent 332042 898c9f87a4c48c0cbc5d9afe6ced9eb3c71f9388
child 332044 76830a19c86a98f3d63d187985659ed556e2ced9
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1265794
milestone48.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 1265794: P1. Ensure we can always fit a complete audio frame in an audio buffer. r=rillian MozReview-Commit-ID: 7oF2Yp1ZQIG
dom/media/AudioCompactor.h
--- a/dom/media/AudioCompactor.h
+++ b/dom/media/AudioCompactor.h
@@ -44,17 +44,17 @@ public:
             uint32_t aFrames, uint32_t aChannels, CopyFunc aCopyFunc)
   {
     // If we are losing more than a reasonable amount to padding, try to chunk
     // the data.
     size_t maxSlop = AudioDataSize(aFrames, aChannels) / MAX_SLOP_DIVISOR;
 
     while (aFrames > 0) {
       uint32_t samples = GetChunkSamples(aFrames, aChannels, maxSlop);
-      if (aFrames * aChannels > mSamplesPadding) {
+      if (samples / aChannels > mSamplesPadding / aChannels + 1) {
         samples -= mSamplesPadding;
       }
       AlignedAudioBuffer buffer(samples);
       if (!buffer) {
         return false;
       }
 
       // Copy audio data to buffer using caller-provided functor.