bug 1203380 add custom assignment operator to AudioBlock r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 10 Sep 2015 08:39:12 +1200
changeset 294710 0919409dd75fa4b326619879f212d34fdc213994
parent 294709 b1cd18b4158c7d0eba6b606cc6be39cf17da9a8b
child 294711 3f4912c6cf479fba90859f6cb9be99c8fd702819
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1203380
milestone43.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 1203380 add custom assignment operator to AudioBlock r=padenot
dom/media/webaudio/AudioBlock.h
--- a/dom/media/webaudio/AudioBlock.h
+++ b/dom/media/webaudio/AudioBlock.h
@@ -69,16 +69,22 @@ public:
   void SetNull(StreamTime aDuration) {
     MOZ_ASSERT(aDuration == WEBAUDIO_BLOCK_SIZE);
     SetBuffer(nullptr);
     mChannelData.Clear();
     mVolume = 1.0f;
     mBufferFormat = AUDIO_FORMAT_SILENCE;
   }
 
+  AudioBlock& operator=(const AudioBlock& aBlock) {
+    // Instead of just copying, mBufferIsDownstreamRef must be first cleared
+    // if set.  It is set again for the new mBuffer if possible.  This happens
+    // in SetBuffer().
+    return *this = aBlock.AsAudioChunk();
+  }
   AudioBlock& operator=(const AudioChunk& aChunk) {
     MOZ_ASSERT(aChunk.mDuration == WEBAUDIO_BLOCK_SIZE);
     SetBuffer(aChunk.mBuffer);
     mChannelData = aChunk.mChannelData;
     mVolume = aChunk.mVolume;
     mBufferFormat = aChunk.mBufferFormat;
     return *this;
   }