bug 1205540 initialize mBufferFormat when constructing silent block r?padenot draft
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 21 Sep 2015 11:37:55 +1200
changeset 294507 23cd7da02282b1fe3d66ac247e563da1b6f41d94
parent 293726 73ec4cb30ed73c74ca038df3dd52baefdf13c911
child 294508 e12d65e1d48635250bbfa32db5cb7c905d1099f3
push id5603
push userktomlinson@mozilla.com
push dateMon, 21 Sep 2015 00:50:40 +0000
reviewerspadenot
bugs1205540
milestone43.0a1
bug 1205540 initialize mBufferFormat when constructing silent block r?padenot This makes an AudioBlock valid for code testing mBufferFormat without IsNull(), without the need for explicit SetNull(). This is useful so that setting AudioNodeStream::mLastChunks each iteration is not required for inactive nodes.
dom/media/webaudio/AudioBlock.h
--- a/dom/media/webaudio/AudioBlock.h
+++ b/dom/media/webaudio/AudioBlock.h
@@ -18,16 +18,17 @@ namespace mozilla {
  *
  * Use on graph thread only.
  */
 class AudioBlock : private AudioChunk
 {
 public:
   AudioBlock() {
     mDuration = WEBAUDIO_BLOCK_SIZE;
+    mBufferFormat = AUDIO_FORMAT_SILENCE;
   }
   // No effort is made in constructors to ensure that mBufferIsDownstreamRef
   // is set because the block is expected to be a temporary and so the
   // reference will be released before the next iteration.
   // The custom copy constructor is required so as not to set
   // mBufferIsDownstreamRef without notifying AudioBlockBuffer.
   AudioBlock(const AudioBlock& aBlock) : AudioChunk(aBlock.AsAudioChunk()) {}
   explicit AudioBlock(const AudioChunk& aChunk)