Output from faad2 is always garbled/distorted on my amd64 system. I first noticed this when playing HD trailers from the Apple Movie Trailers site (http://www.apple.com/trailers/) with vlc. The problem also occurs if I use faad2 to decode an mp4 file to wav, then play it with a simple player like alsaplayer or aplay. This has occurred with all recent versions of faad2, including faad2-2.0-r12, which is the latest at the time of writing. The problem is due to a mistake in 040_all_64bit.patch. The defSampleRate field of the faacDecConfiguration structure has been changed from an unsigned long to a uint8_t, whereas it should be a uint32_t. Will attach a new version of the patch.
Created attachment 87537 [details, diff] New version of 040_all_64bit.patch for media-libs/faad2
patch is still not corrected. herd, please do something, it's a oneliner fix.
VLC now plays AAC fine, as it passes through FFmpeg to do so. FAAD problems are too wide and spread to fix them without hurting anything else. The suggestion is to use FFmpeg when possible, to reduce it to a single point of failure.