Skip to content

Commit

Permalink
Backed out changeset 21491130777e (bug 1848660) for causing assertion…
Browse files Browse the repository at this point in the history
… failures on Casting.h. CLOSED TREE
  • Loading branch information
ncsoregi committed Aug 16, 2023
1 parent 465a62b commit 263a227
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 19 deletions.
10 changes: 0 additions & 10 deletions dom/media/test/crashtests/1848660.html

This file was deleted.

Binary file removed dom/media/test/crashtests/1848660.wav
Binary file not shown.
1 change: 0 additions & 1 deletion dom/media/test/crashtests/crashtests.list
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,3 @@ load 1840002.webm
load 1845350.mp4
load noextradata-8ch.html
load invalidfmt.html
load 1848660.html
13 changes: 5 additions & 8 deletions dom/media/wave/WaveDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,24 +701,21 @@ uint16_t FormatChunk::ExtraFormatInfoSize() const {
}

AudioConfig::ChannelLayout::ChannelMap FormatChunk::ChannelMap() const {
// Regular mapping if file doesn't have channel mapping info. Alternatively,
// if the chunk size doesn't have the field for the size of the extension
// data, return a regular mapping.
// Regular mapping if file doesn't have channel mapping info, of if the chunk
// size doesn't have the field for the size of the extension data.
if (WaveFormat() != 0xFFFE || mRaw.Length() < 18) {
return AudioConfig::ChannelLayout(Channels()).Map();
}
// The length of this chunk is at least 18, check if it's long enough to
// hold the WAVE_FORMAT_EXTENSIBLE struct, that is 22 bytes. If not, fall
// back to a common mapping. The channel mapping is four bytes, starting at
// offset 18.
if (ExtraFormatInfoSize() < 22 || mRaw.Length() < 22) {
// back to a common mapping.
if (ExtraFormatInfoSize() < 22) {
return AudioConfig::ChannelLayout(Channels()).Map();
}
// ChannelLayout::ChannelMap is by design bit-per-bit compatible with
// WAVEFORMATEXTENSIBLE's dwChannelMask attribute, we can just cast here.
auto channelMap = static_cast<AudioConfig::ChannelLayout::ChannelMap>(
return static_cast<AudioConfig::ChannelLayout::ChannelMap>(
mRaw[21] | mRaw[20] | mRaw[19] | mRaw[18]);
return channelMap;
}

// DataParser
Expand Down

0 comments on commit 263a227

Please sign in to comment.