mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1203380 add custom AudioBlock copy constructor and make AudioChunk conversion constructor explicit r=padenot
Making the conversion constructor explicit means that it will be obvious if a temporary is created to pass an AudioChunk as an AudioBlock parameter.
This commit is contained in:
parent
87958b0a58
commit
afe78f9887
@ -24,9 +24,16 @@ public:
|
||||
AudioBlock() {
|
||||
mDuration = WEBAUDIO_BLOCK_SIZE;
|
||||
}
|
||||
MOZ_IMPLICIT AudioBlock(const AudioChunk& aChunk) {
|
||||
mDuration = WEBAUDIO_BLOCK_SIZE;
|
||||
operator=(aChunk);
|
||||
// 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)
|
||||
: AudioChunk(aChunk)
|
||||
{
|
||||
MOZ_ASSERT(aChunk.mDuration == WEBAUDIO_BLOCK_SIZE);
|
||||
}
|
||||
~AudioBlock();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user