Fedora 14 Flash Sound Problem - Linus Torvalds to the Rescue

A nice write up of the bug that Linux Torvalds found and fixed. Basically Fedora 14 came with an updated version of glibc that broke the sound (well seriously messed it up) for Adobe Flash Video. The sound sounds very choppy and hard to hear, full of digital artifact like with a bad cell phone call. This was logged as Bugzilla #638477. Linus Torvalds (and others) figured out the problem and came up with a workaround which is easy, elegant and it works.

cat << EOF > mymemcpy.c
void *memcpy(void *dst, const void *src, size_t size)
void *orig = dst;
asm volatile("rep ; movsq"
:"=D" (dst), "=S" (src)
:"0" (dst), "1" (src), "c" (size >> 3)
asm volatile("rep ; movsb"
:"=D" (dst), "=S" (src)
:"0" (dst), "1" (src), "c" (size & 7)
return orig;

# Compile and link
gcc -O2 -c mymemcpy.c
ld -G mymemcpy.o -o mymemcpy.so
# Install
sudo cp mymemcpy.so /usr/local/lib64/
# chcon is for SELinux users
sudo chcon --reference=/lib64/libc.so.6 /usr/local/lib64/mymemcpy.so
# Patch the script that runs Firefox
sudo sed -i 's,\(^[[:space:]]*\)\("$prog" ${1+"$@"}\),\1LD_PRELOAD=/usr/local/lib64/mymemcpy.so \2,' /usr/lib64/firefox-3.6/run-mozilla.sh

Except when I did this the last statement the "sed" statement didn't work for a couple of reasons. For one thing I'm up to Firefox 4RC1 so the path is wrong and for another the pattern match isn't quite right.

So I simply went to /usr/lib64/firefox-4rc1/run-mozilla.sh and hand-edited the last few lines of the file to make them look like so

if [ $moz_debug -eq 1 ]if [ $moz_debug -eq 1 ]
LD_PRELOAD=/usr/local/lib64/mymemcpy.so moz_debug_program ${1+"$@"}
LD_PRELOAD=/usr/local/lib64/mymemcpy.so moz_run_program ${1+"$@"}

After these simple steps the sound sounds as it should. Thanks Linus and Linux!
Post a Comment

Popular posts from this blog

Hit failing alternator with a hammer to confirm diagnosis of failing alternator due to bad brushes

alternatives --install gets stuck: failed to read link: No such file or directory

Using SSH, SOCKS, tsocks, and proxy settings to create a simultaneous "dual use" work/home computer