bug 1391482 permit AudioChunk channel data initialization when mBuffer is not shared r=padenot

MozReview-Commit-ID: AZ30fTVHHce

--HG--
extra : rebase_source : 313f0e643c9fce3500fe4c238929c4636560834e
This commit is contained in:
Karl Tomlinson 2017-08-16 18:37:30 +12:00
Родитель 9a6e4c2741
Коммит d17ceb8a8f
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -233,6 +233,18 @@ struct AudioChunk {
(&mChannelData);
}
/**
* ChannelFloatsForWrite() should be used only when mBuffer is owned solely
* by the calling thread.
*/
template<typename T>
T* ChannelDataForWrite(size_t aChannel)
{
MOZ_ASSERT(AudioSampleTypeToFormat<T>::Format == mBufferFormat);
MOZ_ASSERT(!mBuffer->IsShared());
return static_cast<T*>(const_cast<void*>(mChannelData[aChannel]));
}
PrincipalHandle GetPrincipalHandle() const { return mPrincipalHandle; }
StreamTime mDuration; // in frames within the buffer