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.
--- 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)