One way to narrow down the problem is by testing a sound file using a media player. That way, you can rule out the browser and Internet connection as causes.
It's not necessarily a hardware problem. If you are able, you can test the sound using the same YouTube videos in Windows also, to see if you hear the problem.
I went through a very similar, if not identical problem, and it was a nightmare: viewtopic.php?f=48&t=259469&start=40
. Maybe some of the suggestions there will help you.
In my case, the problem didn't appear to be happening in Windows, so I'm fairly certain it wasn't a hardware problem. After trying numerous possible fixes posted by helpful members of the forum, I finally gave up and used a USB sound card to bypass the problem. If you don't already have one, the cheapest ones are less than $10. I haven't tested exhaustively yet, but the problem appears to be gone.
My best guess is that there was some kind of incompatibility between Linux's sound drivers (or another package) and my hardware. The problem seems simple enough, but there are numerous possible causes. See this page, for example: https://wiki.archlinux.org/index.php/Pu ... leshooting
After trying the most obvious fixes, using a cheap sound card may be a practical bypass worth considering.