Choppy Flash Sound under 64-bit Linux

This took me some time to figure out and the culprit is quite unusual, hence I decided to reproduce the solution here. If you get choppy sound and a weird beat of beeps when you play (low sound quality) flash videos under 64-bit Linux, then it is because of a change in memcpy provided by glibc. Linux Torwalds suggested the following fix which works for me:

prompt$ cat > 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;
prompt$ gcc -O2 -c mymemcpy.c
prompt$ ld -G mymemcpy.o -o
prompt$ LD_PRELOAD=$(pwd)/ /opt/google/chrome/google-chrome &

The full thread is worth a read.

Update: This is better.


11 thoughts on “Choppy Flash Sound under 64-bit Linux”

  1. Thanks for this post! It really solves it.
    Note that the source you’ve pasted doesn’t compile, as it lacks the “” in the first #include line.

  2. Why on earth do you use that “pwd”? It is nonsense having to navigate the “right” directory in order to get the wanted result.

  3. I think nobody should use this solution. It does not fix anything, only hides the bug. Also, it is hard to use, you need to “fix” running environment for every application that uses

    Much better solution is to fix relocation entries in Download , save it as “memcpy2memmove.cpp”, then compile it by running “g++ memcpy2memmove.cpp -o memcpy2memmove”, then run it like this “sudo ./memcpy2memmove /path/to/”. That’s it. This is correct, permanent fix if this bug (actually, fixing source code and recompiling is correct fix, but for closed source we have to fix the binary).

    To me it looks like Adobe does not care at all. They so lazy that even after so many month (!) they “can’t” spend a minute of one person’s time to replace “memcpy” with “memmove” in their source code and do a proper release (actually, they shouldn’t be using memcpy in the first place).


  4. YES! Lisss, thank you so much for this. My small kids love playing some SWF games (for fun and schoolwork) and the audio was driving me nuts.

    1. I don’t believe so, as this seems to have solved my problem running Adobe Flash Player version and Linux 64-bit, Chrome running on Fedora 15.

  5. @Liss: I used your way. Works perfectly.

    @martinalbrecht: thanks for posting this in the first place. I used a VirtualBox with Win7 to play most flash videos because of the sound issues :O

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s