mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
bug 1203380 tighten not-sharing assertion in ChannelFloatsForWrite() r=padenot
--HG-- extra : rebase_source : 5206ae1ae59bade7f2b40400e0f851bf26df5d9c
This commit is contained in:
parent
4935533d54
commit
99d66c32cb
@ -124,9 +124,12 @@ AudioBlock::ClearDownstreamMark() {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioBlock::AssertNoLastingShares() {
|
||||
MOZ_ASSERT(!mBuffer->AsAudioBlockBuffer()->HasLastingShares());
|
||||
bool
|
||||
AudioBlock::CanWrite() {
|
||||
// If mBufferIsDownstreamRef is set then the buffer is not ours to use.
|
||||
// It may be in use by another node which is not downstream.
|
||||
return !mBufferIsDownstreamRef &&
|
||||
!mBuffer->AsAudioBlockBuffer()->HasLastingShares();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -54,12 +54,14 @@ public:
|
||||
*/
|
||||
void AllocateChannels(uint32_t aChannelCount);
|
||||
|
||||
/**
|
||||
* ChannelFloatsForWrite() should only be used when the buffers have been
|
||||
* created with AllocateChannels().
|
||||
*/
|
||||
float* ChannelFloatsForWrite(size_t aChannel)
|
||||
{
|
||||
MOZ_ASSERT(mBufferFormat == AUDIO_FORMAT_FLOAT32);
|
||||
#if DEBUG
|
||||
AssertNoLastingShares();
|
||||
#endif
|
||||
MOZ_ASSERT(CanWrite());
|
||||
return static_cast<float*>(const_cast<void*>(mChannelData[aChannel]));
|
||||
}
|
||||
|
||||
@ -103,7 +105,7 @@ public:
|
||||
|
||||
private:
|
||||
void ClearDownstreamMark();
|
||||
void AssertNoLastingShares();
|
||||
bool CanWrite();
|
||||
|
||||
// mBufferIsDownstreamRef is set only when mBuffer references an
|
||||
// AudioBlockBuffer created in a different AudioBlock. That can happen when
|
||||
|
Loading…
Reference in New Issue
Block a user