From d17ceb8a8f9965f199a547f007298c1d6192504f Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Wed, 16 Aug 2017 18:37:30 +1200 Subject: [PATCH] bug 1391482 permit AudioChunk channel data initialization when mBuffer is not shared r=padenot MozReview-Commit-ID: AZ30fTVHHce --HG-- extra : rebase_source : 313f0e643c9fce3500fe4c238929c4636560834e --- dom/media/AudioSegment.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/media/AudioSegment.h b/dom/media/AudioSegment.h index 00b805db1021..c78f56872bf3 100644 --- a/dom/media/AudioSegment.h +++ b/dom/media/AudioSegment.h @@ -233,6 +233,18 @@ struct AudioChunk { (&mChannelData); } + /** + * ChannelFloatsForWrite() should be used only when mBuffer is owned solely + * by the calling thread. + */ + template + T* ChannelDataForWrite(size_t aChannel) + { + MOZ_ASSERT(AudioSampleTypeToFormat::Format == mBufferFormat); + MOZ_ASSERT(!mBuffer->IsShared()); + return static_cast(const_cast(mChannelData[aChannel])); + } + PrincipalHandle GetPrincipalHandle() const { return mPrincipalHandle; } StreamTime mDuration; // in frames within the buffer