Skip to content

Commit

Permalink
mpa: Ignore invalid emphasis value in header.
Browse files Browse the repository at this point in the history
The emphasis value should never be 0x2 since that is a reserved value.
However, there exist some files where this value is used. Allow these
these files to play by assuming no emphasis is used in such cases.

Fixes #192.
  • Loading branch information
pdeljanov committed May 26, 2023
1 parent 1cfef5b commit c7d7968
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions symphonia-bundle-mp3/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ pub fn check_header(header: u32) -> bool {
if (header >> 10) & 0x3 == 0x3 {
return false;
}
// Emphasis (0x2 is not allowed)
if header & 0x3 == 0x2 {
return false;
}
true
}

Expand Down Expand Up @@ -190,10 +186,9 @@ pub fn parse_frame_header(header: u32) -> Result<FrameHeader> {
}

let emphasis = match header & 0x3 {
0b00 => Emphasis::None,
0b01 => Emphasis::Fifty15,
0b11 => Emphasis::CcitJ17,
_ => return decode_error("mpa: invalid emphasis"),
_ => Emphasis::None,
};

let is_copyrighted = header & 0x8 != 0x0;
Expand Down

0 comments on commit c7d7968

Please sign in to comment.