Bug 1305826: P2. Ensure the buffer size is of the right size. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 01 Oct 2016 18:56:21 +1000
changeset 316129 66fc89b8e43a594e13eec246f9e983ef37cc9f8e
parent 316128 9f9aa517e499c77d2c1b205458175113dfdb841a
child 316130 7a131d2860bd49d9a11de4a3a63a089b6e21a7e1
push id30762
push userphilringnalda@gmail.com
push dateSat, 01 Oct 2016 21:00:36 +0000
treeherdermozilla-central@d1fd56faaeb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1305826
milestone52.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 1305826: P2. Ensure the buffer size is of the right size. r=gerald The AudioSink uses the size of the buffer to determine the number of frames present. We must ensure that the size of the buffer matches the mFrames member. MozReview-Commit-ID: 3oblyOCnGEB
dom/media/AudioCompactor.h
--- a/dom/media/AudioCompactor.h
+++ b/dom/media/AudioCompactor.h
@@ -56,16 +56,17 @@ public:
       if (!buffer) {
         return false;
       }
 
       // Copy audio data to buffer using caller-provided functor.
       uint32_t framesCopied = aCopyFunc(buffer.get(), samples);
 
       NS_ASSERTION(framesCopied <= aFrames, "functor copied too many frames");
+      buffer.SetLength(size_t(framesCopied) * aChannels);
 
       CheckedInt64 duration = FramesToUsecs(framesCopied, aSampleRate);
       if (!duration.isValid()) {
         return false;
       }
 
       mQueue.Push(new AudioData(aOffset,
                                 aTime,