Created attachment 571996 [details, diff] Patch to replace -O3 with -O2 Listening to m4a files via rhythmbox -> gstreamer > faad sounds distorted (with a metallic sound, like old, badly encoded mp3s used to have.) I narrowed this down to faad itself, as a direct decode there shows the same issue. faad -o test.wav input.m4a Playing the m4a in other programs (such as mplayer or ffplay) shows no issue and the song sounds correct. Downloading/building the faad source code directly shows no problem either, and files sound correct after being decoded through a local build of the same version. After much testing, I narrowed it down to having -O3 set in CFLAGS. Switching to -O2 completely fixes the issue. (Note, I also tried removing march=native, but that didn't help.) Attached is a small patch using flag-o-matic to reduce -O3 to -O2.
Created attachment 571998 [details] emerge --info
For future clarity, this is faad2-2.8.8 (the only version in portage currently)
Can confirm that switching from -O3 to -O2 solves the problem (at least for faad2-2.8.8). I encountered that bug about half year ago when I blindly enabled all media codec flags I could find (didn't think about the possible downsides). Most videos played fine, but those with aac tracks had this metallic distorted sound. Because it only affected vlc, but not mpv, I was able o track it down to faad2 and just disabled the decoder. I wonder if miscompiled faad2 may affect browser video playback too? At first glance firefox seems to be using only libfdk-aac and libavcodec for aac. Also, did you notify upstream of the bug?
> Also, did you notify upstream of the bug? I did not. Completely unsure if it's a GCC bug, a FAAD2 bug, or some other interaction. As it IS definitely related to the build flags (and that completely solves the issue), it felt like a gentoo/ebuild patch was the most reasonable approach.
can you please post an update about the latest version of faad2? currently we have 2.10.1 in the tree.
(In reply to Xepher from comment #4) > > Also, did you notify upstream of the bug? > > I did not. Completely unsure if it's a GCC bug, a FAAD2 bug, or some other > interaction. As it IS definitely related to the build flags (and that > completely solves the issue), it felt like a gentoo/ebuild patch was the > most reasonable approach. In general, you should assume it's a program bug if -O3 breaks something.
Ran my original tests again, and it works fine with -O3 now, with 2.10.1 (and of course whatever current versions of other packages like GCC are in my system now.)
thanks for the test and report