Closed Bug 1253296 Opened 9 years ago Closed 9 years ago

glitchy audio during youtube videos on Linux

Categories

(Core :: Audio/Video: Playback, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1242783
Tracking Status
firefox46 + fixed
firefox47 + fixed

People

(Reporter: froydnj, Assigned: jwwang)

References

Details

(Keywords: regression)

Attachments

(2 files)

[Tracking Requested - why for this release]: glitchy audio on YouTube and other video sites On my home desktop machine, playing YouTube videos (or anything else, really; videos in tweetstreams, instagram videos, etc.) sounds extremely glitchy, like 1/4-1/2 second of every second is dropped. VLC plays OK, so I don't think this is a problem with my sound setup. I bisected this to: Nightly 12 Jan - good - https://hg.mozilla.org/mozilla-central/rev/e790bba372f14241addda469a4bdb7ab00786ab3 Nightly 13 Jan - bad - bad https://hg.mozilla.org/mozilla-central/rev/ad1f85f172b7302bef0fa9780df8e2b962780ac6 https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=e790bba372f14241addda469a4bdb7ab00786ab3&tochange=ad1f85f172b7302bef0fa9780df8e2b962780ac6 Just looking through the commit lists suggests several possibilities: - bug 948267 - bug 1239078 (libopus update) - bug 1190939 (VP9 4:4:4 decoding) - bug 1235966 - bug 769117 (seems unlikely, as flash doesn't really work on this machine...) Those are all the ones that look audio related and are non-trivial. I haven't had issues like this before...and it seems nobody else has either, for a regression that happened a month and a half ago. Is there anything I can provide that might help in tracking this down?
jean-yves, any thoughts here?
Flags: needinfo?(jyavenard)
Looks like a recent regression, tracking for 46+.
Nathan - can you see if reverting any of those patches fixes the issue?
Flags: needinfo?(nfroyd)
What are the specific youtube URLs with glitchy audio?
Can you please provide the linux (e.g. distribution) version you are using and a link to a video causing the issue? thanks
Flags: needinfo?(jyavenard)
working here with Ubuntu 15.10 e10s on.= and ffmpeg 2.7.6 (though this doesn't matter with youtube as it would typically use vp9 + opus)
(In reply to Jean-Yves Avenard [:jya] from comment #5) > Can you please provide the linux (e.g. distribution) version you are using > and a link to a video causing the issue? This is on Ubuntu 14.10 in Nightly, e10s on. Examples of glitchiness: https://www.youtube.com/watch?v=Xn3tUOJ9yv4 https://www.instagram.com/p/BCbp5sCqq6v/ https://twitter.com/BBAnimals/status/706617186425688064 https://vimeo.com/144499042 That's a representative sample; I haven't found a youtube video that isn't glitchy yet.
Just to check - you do have PulseAudio installed, right?
(In reply to Anthony Jones (:kentuckyfriedtakahe, :k17e) from comment #8) > Just to check - you do have PulseAudio installed, right? Yes. @nightcrawler:~/tmp$ psgrep pulseaudio USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND froydnj 3729 0.1 0.1 470132 9572 ? S<l Feb15 61:05 pulseaudio -D froydnj 3742 0.0 0.0 98812 0 ? S Feb15 0:00 /usr/lib/pulseaudio/pulse/gconf-helper
Flags: needinfo?(nfroyd)
Nathan, can you list all the packages you have installed? In particular ffmpeg one. Did you install 3rd party ones?
(In reply to Jean-Yves Avenard [:jya] from comment #10) > Nathan, can you list all the packages you have installed? All of the packages would be a pretty big list. :) > In particular ffmpeg one. Did you install 3rd party ones? i A chromium-codecs-ffmpeg - Free ffmpeg codecs for the Chromium Browse i ffmpeg - Multimedia player, server, encoder and tra i ffmpeg2theora - Theora video encoder using ffmpeg i ffmpegthumbs - video thumbnail generator using ffmpeg i gmerlin-encoders-ffmpeg - ffmpeg encoders for Gmerlin i gstreamer0.10-ffmpeg - FFmpeg plugin for GStreamer i A libxine1-ffmpeg - MPEG-related plugins for libxine1 i A libxine2-ffmpeg - MPEG-related plugins for libxine2 I do not have any third-party sources in my sources.list. My Ubuntu repositories are "main restricted multiverse universe", if that makes a difference. ffmpeg says its version is 0.8.6, but it also says it's a transitional package...libav* shows a number of packages listed, though, do you need versions of any of those?
that is weird, 14.04 shipped with LibAV 9.4. 14.10 is supposed to come with LibAV 9.11. How could you still have 0.8.6 (which is the version that shipped with 12.04) when you right click on the youtube video and select "stats for nerds", what do you get? Can you uninstall all ffmpeg related codec (including libavcodec* / libavutil*) (can re-install them, for Firefox you just need libavcodec54) can you run in a debug build with NSPR_LOG_MODULES=MediaFormatReader:5,PlatformDecoderModule:5 and see if there's anything special. If nothing shows up there, it may be outside of media (like cubeb or something)
Stats for nerds says: Video ID: Xn3tUOJ9yv4 Dimensions: 854 x 480 Resolution: 854 x 480@30 Volume: 100% Stream Host: r13---sn-vgqs7n7d Stream Type: https CPN: AfzgilP7PbizOoJe Mime Type: video/webm; codecs="vp9" DASH: yes (244/251) libav-wise, I have libavcodec5{2,3,4,6} and libavutil5{0,1,2,3}. I'm a little reluctant to uninstall things because I can't find a 14.10 repository anywhere. :( I should probably just upgrade... try built all my bisection candidates; I'll report on those tomorrow.
Bisecting shows that bug 948267 was responsible for changing this.
Blocks: 948267
Can you run with |NSPR_LOG_MODULES=timestamp:1,MediaDecoder:4,AudioStream:3| and attach the logs? I wonder if there are audio buffer underruns to intermittent silence and glitchy sound. Btw, it will also help to run firefox under a Ubuntu install disc without actually installing it so you have a clean set of packages to test.
Here's a log from playing the first couple seconds of a youtube video. I see from /proc/maps: 7f1cc5f60000-7f1cc6691000 r-xp 00000000 08:11 140618 /usr/lib/x86_64-linux-gnu/libavcodec.so.56.1.0 7f1cc6691000-7f1cc6891000 ---p 00731000 08:11 140618 /usr/lib/x86_64-linux-gnu/libavcodec.so.56.1.0 7f1cc6891000-7f1cc68a9000 r--p 00731000 08:11 140618 /usr/lib/x86_64-linux-gnu/libavcodec.so.56.1.0 7f1cc68a9000-7f1cc68c3000 rw-p 00749000 08:11 140618 /usr/lib/x86_64-linux-gnu/libavcodec.so.56.1.0 7f1ccd03a000-7f1ccd05d000 r-xp 00000000 08:11 142492 /usr/lib/x86_64-linux-gnu/libavutil.so.54.3.0 7f1ccd05d000-7f1ccd25d000 ---p 00023000 08:11 142492 /usr/lib/x86_64-linux-gnu/libavutil.so.54.3.0 7f1ccd25d000-7f1ccd260000 r--p 00023000 08:11 142492 /usr/lib/x86_64-linux-gnu/libavutil.so.54.3.0 7f1ccd260000-7f1ccd261000 rw-p 00026000 08:11 142492 /usr/lib/x86_64-linux-gnu/libavutil.so.54.3.0 7f1cd06f7000-7f1cd0714000 r-xp 00000000 08:11 142494 /usr/lib/x86_64-linux-gnu/libavresample.so.2.1.0 7f1cd0714000-7f1cd0914000 ---p 0001d000 08:11 142494 /usr/lib/x86_64-linux-gnu/libavresample.so.2.1.0 7f1cd0914000-7f1cd0917000 r--p 0001d000 08:11 142494 /usr/lib/x86_64-linux-gnu/libavresample.so.2.1.0 7f1cd0917000-7f1cd0918000 rw-p 00020000 08:11 142494 /usr/lib/x86_64-linux-gnu/libavresample.so.2.1.0 The mismatch between libavcodec and libavutil isn't problematic, is it? I found a utopic repository yesterday, so I can try uninstalling and reinstalling things once I get package dependencies figured out.
Flags: needinfo?(jwwang)
(In reply to Jean-Yves Avenard [:jya] from comment #12) > when you right click on the youtube video and select "stats for nerds", what > do you get? > > Can you uninstall all ffmpeg related codec (including libavcodec* / > libavutil*) (can re-install them, for Firefox you just need libavcodec54) I uninstalled libavcodec*/libavutil*. My /proc/maps for plugin-container.exe now says: 7fb134c70000-7fb134c77000 r-xp 00000000 08:12 4063376 /home/froydnj/firefox/libmozavcodec.so 7fb134c77000-7fb134c80000 ---p 00007000 08:12 4063376 /home/froydnj/firefox/libmozavcodec.so 7fb134c80000-7fb134ea0000 r-xp 00006000 08:12 4063376 /home/froydnj/firefox/libmozavcodec.so 7fb134ea0000-7fb13509f000 ---p 00230000 08:12 4063376 /home/froydnj/firefox/libmozavcodec.so 7fb13509f000-7fb1350ac000 rw-p 00225000 08:12 4063376 /home/froydnj/firefox/libmozavcodec.so 7fb1350ac000-7fb1350b4000 r-xp 00000000 08:12 4063282 /home/froydnj/firefox/libmozavutil.so 7fb1350b4000-7fb1350b6000 ---p 00008000 08:12 4063282 /home/froydnj/firefox/libmozavutil.so 7fb1350b6000-7fb1350e3000 r-xp 00007000 08:12 4063282 /home/froydnj/firefox/libmozavutil.so 7fb1350e3000-7fb1352e2000 ---p 00037000 08:12 4063282 /home/froydnj/firefox/libmozavutil.so 7fb1352e2000-7fb1352f3000 rw-p 00033000 08:12 4063282 /home/froydnj/firefox/libmozavutil.so and the audio is still quite glitchy.
2016-03-10 16:49:49.118092 UTC - [0x7fc6466fc1a0]: W/AudioStream AudioStream 7fc646cc0ce0 lost 4051 frames 2016-03-10 16:49:49.118177 UTC - [0x7fc6466fc1a0]: W/AudioStream AudioStream 7fc646cc0ce0 lost 8184 frames 2016-03-10 16:49:49.118266 UTC - [0x7fc6466fc1a0]: W/AudioStream AudioStream 7fc646cc0ce0 lost 3424 frames 2016-03-10 16:49:49.759698 UTC - [0x7fc6466fc1a0]: W/AudioStream AudioStream 7fc646cc0ce0 lost 4072 frames 2016-03-10 16:49:49.759725 UTC - [0x7fc6466fc1a0]: W/AudioStream AudioStream 7fc646cc0ce0 lost 3740 frames There is audio buffer underrun. Did you have PulseAudio installed and what is it's version?
Flags: needinfo?(jwwang)
(In reply to JW Wang [:jwwang] from comment #18) > There is audio buffer underrun. Did you have PulseAudio installed and what > is it's version? Yes; pulseaudio --version says 4.0.
(In reply to Nathan Froyd [:froydnj] from comment #16) > The mismatch between libavcodec and libavutil isn't problematic, is it? no.. that's how they are numbered; up until very recently the version number of libavutil had no linked to libavcodec so you could have 56 in one and 54 in the other. With the release of FFmpeg 3.0, they are both 57. > > I found a utopic repository yesterday, so I can try uninstalling and > reinstalling things once I get package dependencies figured out. normally, libavcodec shouldn't be used with nightly to play most youtube video as they are webm/vp9 and for which we use our own libmozavcodec.
(In reply to Nathan Froyd [:froydnj] from comment #19) > (In reply to JW Wang [:jwwang] from comment #18) > > There is audio buffer underrun. Did you have PulseAudio installed and what > > is it's version? > > Yes; pulseaudio --version says 4.0. what is the content of : /proc/asound/card%1/pcm%2p/sub%3/prealloc where %1 is the audio card number (if you only have one it will be 0) %2 is the device number and %3 is the subdevice. you can get the list of audio device with: aplay -l on my Ubuntu 14.04 VM that shows: **** List of PLAYBACK Hardware Devices **** card 0: AudioPCI [Ensoniq AudioPCI], device 0: ES1371/1 [ES1371 DAC2/ADC] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: AudioPCI [Ensoniq AudioPCI], device 1: ES1371/2 [ES1371 DAC1] Subdevices: 1/1 Subdevice #0: subdevice #0 so: here %1 = 0, %2 = %3 = 0 /proc/asound/card0/pcm0p/sub0/prealloc ALSA default is 4kB but Ubuntu bump that to 64kB. Which is often still too low. you can bump that to 128 or ever 256 and see how that goes for you. If you're not sure on which card is being used by pulse, it's safe to bump the prealloc value on all of them. Does that help?
cat /proc/asouns/card1/pcm*p/sub*/prealloc indicates that all of them are set to 256 already.
The values for /proc/asound/card0/*, though, are all 64...but those are for HDMI devices, which I don't use. My speakers are hooked up to card1.
and if you set them all to 64 then ? :) just curious
the value can be bumped up to 4MB I believe on intel device, so you may wish to up that even more (set it to 4096). In my past experience, too low prealloc values are typically the cause of underbuffer. but the underbuffer may be occurring in pulse, in which case changing the alsa HW buffer size will make no difference.
and what do you have in /etc/pulse/daemon.conf ?
(In reply to Jean-Yves Avenard [:jya] from comment #25) > the value can be bumped up to 4MB I believe on intel device, so you may wish > to up that even more (set it to 4096). > > In my past experience, too low prealloc values are typically the cause of > underbuffer. > but the underbuffer may be occurring in pulse, in which case changing the > alsa HW buffer size will make no difference. The underrun happens in AudioStream which means MDSM doesn't decode as fast as AudioStream(cubeb datacallback) consumes.
For comparison's sake, here's a log from a smoothly playing version, about 10-15 seconds of audio.
(In reply to JW Wang [:jwwang] from comment #29) > Can you try if this build works for you? > > http://archive.mozilla.org/pub/firefox/try-builds/jwwang@mozilla.com- > 5b51f42ab5af9bfb2b407d0c121211eaeaefa0b8/try-linux64/ That build sounds great! So nice to not have glitchy audio. :)
Flags: needinfo?(nfroyd)
JW -- Can you officially take this bug and put up a patch for review? Per Nathan, your latest build fixes this bug (which is awesome!). I realize you're already driving the fix forward, but since this bug is marked as a recent regression introduced in Fx46, it's listed as blocking release and needs an official owner. Thanks!
Assignee: nobody → jwwang
This bug is the same as bug 1242783 where we have glitchy audio when high latency audio device is used like BT headphone.
Depends on: 1242783
Thanks, JW. Does it make sense to close this as a duplicate of Bug 1242783 (since that's where the work is happening)? Or do you feel more comfortable leaving this open?
Flags: needinfo?(jwwang)
Sure. Please make it a dup of Bug 1242783. Thanks!
Flags: needinfo?(jwwang)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: