From c7d796874ce4f38e8179315e2069cdf81ddc565f Mon Sep 17 00:00:00 2001 From: Philip Deljanov Date: Fri, 26 May 2023 00:03:25 -0400 Subject: [PATCH] mpa: Ignore invalid emphasis value in header. 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. --- symphonia-bundle-mp3/src/header.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/symphonia-bundle-mp3/src/header.rs b/symphonia-bundle-mp3/src/header.rs index d1cb6541..e0856f9e 100644 --- a/symphonia-bundle-mp3/src/header.rs +++ b/symphonia-bundle-mp3/src/header.rs @@ -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 } @@ -190,10 +186,9 @@ pub fn parse_frame_header(header: u32) -> Result { } 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;