зеркало из https://github.com/mozilla/gecko-dev.git
bug 1404220 provide default initializers for all AudioChunk members r=padenot
This avoids any risk of undefined behavior when evaluating uninitialized members, during copies for example, and makes it safe to test mBufferFormat when null. MozReview-Commit-ID: IMAyZ1CSHbk --HG-- extra : rebase_source : b02431634732cf63d6fe9ede5eb1400a2baa6308
This commit is contained in:
Родитель
c14c88b4c3
Коммит
f3b25c6e88
|
@ -150,10 +150,6 @@ DownmixAndInterleave(const nsTArray<const SrcT*>& aChannelData,
|
|||
struct AudioChunk {
|
||||
typedef mozilla::AudioSampleFormat SampleFormat;
|
||||
|
||||
AudioChunk()
|
||||
: mPrincipalHandle(PRINCIPAL_HANDLE_NONE)
|
||||
{}
|
||||
|
||||
// Generic methods
|
||||
void SliceTo(StreamTime aStart, StreamTime aEnd)
|
||||
{
|
||||
|
@ -249,18 +245,19 @@ struct AudioChunk {
|
|||
|
||||
PrincipalHandle GetPrincipalHandle() const { return mPrincipalHandle; }
|
||||
|
||||
StreamTime mDuration; // in frames within the buffer
|
||||
StreamTime mDuration = 0; // in frames within the buffer
|
||||
RefPtr<ThreadSharedObject> mBuffer; // the buffer object whose lifetime is managed; null means data is all zeroes
|
||||
// one pointer per channel; empty if and only if mBuffer is null
|
||||
AutoTArray<const void*,GUESS_AUDIO_CHANNELS> mChannelData;
|
||||
float mVolume; // volume multiplier to apply (1.0f if mBuffer is nonnull)
|
||||
SampleFormat mBufferFormat; // format of frames in mBuffer (only meaningful if mBuffer is nonnull)
|
||||
float mVolume = 1.0f; // volume multiplier to apply
|
||||
// format of frames in mBuffer (or silence if mBuffer is null)
|
||||
SampleFormat mBufferFormat = AUDIO_FORMAT_SILENCE;
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
mozilla::TimeStamp mTimeStamp; // time at which this has been fetched from the MediaEngine
|
||||
#endif
|
||||
// principalHandle for the data in this chunk.
|
||||
// This can be compared to an nsIPrincipal* when back on main thread.
|
||||
PrincipalHandle mPrincipalHandle;
|
||||
PrincipalHandle mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче