Bug 1530322 - P3. Add diagnostics. r=gerald

Depends on D21172

Differential Revision: https://phabricator.services.mozilla.com/D21173

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-02-26 06:39:57 +00:00
Родитель 842cb08843
Коммит 120c38f502
2 изменённых файлов: 7 добавлений и 1 удалений

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

@ -86,6 +86,8 @@ bool AudioData::SetTrimWindow(const media::TimeInterval& aTrim) {
// Overflow. // Overflow.
return false; return false;
} }
MOZ_DIAGNOSTIC_ASSERT(trimAfter.value() >= trimBefore.value(),
"Something went wrong with trimming value");
if (!mTrimWindow && trimBefore == 0 && trimAfter == originalFrames) { if (!mTrimWindow && trimBefore == 0 && trimAfter == originalFrames) {
// Nothing to change, abort early to prevent rounding errors. // Nothing to change, abort early to prevent rounding errors.
return true; return true;
@ -93,7 +95,11 @@ bool AudioData::SetTrimWindow(const media::TimeInterval& aTrim) {
mTrimWindow = Some(aTrim); mTrimWindow = Some(aTrim);
mDataOffset = trimBefore.value() * mChannels; mDataOffset = trimBefore.value() * mChannels;
MOZ_DIAGNOSTIC_ASSERT(mDataOffset <= mAudioData.Length(),
"Data offset outside original buffer");
mFrames = (trimAfter - trimBefore).value(); mFrames = (trimAfter - trimBefore).value();
MOZ_DIAGNOSTIC_ASSERT(mFrames <= originalFrames,
"More frames than found in container");
mTime = mOriginalTime + FramesToTimeUnit(trimBefore.value(), mRate); mTime = mOriginalTime + FramesToTimeUnit(trimBefore.value(), mRate);
mDuration = FramesToTimeUnit(mFrames, mRate); mDuration = FramesToTimeUnit(mFrames, mRate);

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

@ -182,7 +182,7 @@ class AlignedBuffer {
static size_t AlignmentPaddingSize() { return AlignmentOffset() * 2; } static size_t AlignmentPaddingSize() { return AlignmentOffset() * 2; }
void PopFront(size_t aSize) { void PopFront(size_t aSize) {
MOZ_ASSERT(mLength >= aSize); MOZ_DIAGNOSTIC_ASSERT(mLength >= aSize, "Popping too many frames");
PodMove(mData, mData + aSize, mLength - aSize); PodMove(mData, mData + aSize, mLength - aSize);
mLength -= aSize; mLength -= aSize;
} }