Skip to content

Commit

Permalink
Bug 1835866 - Add information to crash reports when setting the trimm…
Browse files Browse the repository at this point in the history
…ing window for an AudioBuffer fails. r=pehrsons data-review=chutten

Differential Revision: https://phabricator.services.mozilla.com/D179693
  • Loading branch information
padenot committed Jun 1, 2023
1 parent eccd565 commit 16b7bd7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dom/media/MediaData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ bool AudioData::SetTrimWindow(const media::TimeInterval& aTrim) {
size_t frameOffset = trimBefore.ToTicksAtRate(mRate);
mTrimWindow = Some(aTrim);
mDataOffset = frameOffset * mChannels;
MOZ_DIAGNOSTIC_ASSERT(mDataOffset <= mAudioData.Length(),
"Data offset outside original buffer");
if (frameOffset * mChannels > mAudioData.Length()) {
MOZ_CRASH_UNSAFE_PRINTF(
"Data offset outside original buffer: %zu > %zu (%s -- %s)",
frameOffset * mChannels, mAudioData.Length(), aTrim.ToString().get(),
media::TimeInterval{mOriginalTime, GetEndTime()}.ToString().get());
}
mFrames = (trimAfter - trimBefore).ToTicksAtRate(mRate);
MOZ_DIAGNOSTIC_ASSERT(mFrames <= mAudioData.Length() / mChannels,
"More frames than found in container");
Expand Down

0 comments on commit 16b7bd7

Please sign in to comment.