Stuttering video in browsers - OSS related.

Hello everybody.
I'm during moving from Linux to FreeBSD and most issues experienced were more or less easy to solve. Except one. Details are:

  • 13.5 release, AMD64, quarterly branch.
  • Nvidia drivers installed from packages, not directly from Nvidia.
  • Xonar D1 soundcard - not supported directly and a bit tricky to make to work. This is probably the main cause of issue described below.
  • KDE installed manually, not using desktop-installer.
  • Custom kernel used (just generic recompiled without sound support).
  • OSS audio installed with custom driver by Alexander Polakov
Almost everything works OK. Sound is working flawlessly (system sounds, music played by Audacious, videos played by mpv or VLC etc.). But while trying to play any video using WWW browser (like Youtube or other media platform or even local video file opened with browser), first 2-3 seconds are OK, then audio is playing normally, but video starts to be really choppy - about one frame per second. Just impossible to watch. No CPU/GPU usage peaks, so it's not performance related.

What's more interesting - such behavior is found in both Firefox and Chromium (standard or ungoogled). But Falkon and Krusader can play any video without any issues, no stuttering, smooth playing.

When I disable OSS completely, videos work perfectly in Firefox and Chromium too, but obviously without audio.

I've tried to mess with sysctl kern.sched.steal_thresh=0 or 1 setting or set "load-module module-oss device="/dev/dsp" sink_name=output fragment_size=8192" in /usr/local/etc/pulse/default.pa file (found using Google, a bit of blind shots), but it didn't work at all.


So the issue is related to "something" about media playing that differs between Falkon/Krusader and Firefox/Chromium. I tried to figure it out, but didn't find anything useful. Could you please share your thoughts? Any suggestions will be appreciated, even the most obvious ones (maybe I just miss something simple?).

Thank you in advance!
 
Replying to myself.

Found some kind of solution. Changing audio output (backend) directly in browser from oss to alsa fixed the problem.

Is it a real solution? Not really. This fix works only in Ungoogled Chromium. There's no such option in Chromium, Brave, Opera, Vivaldi etc. Yes, I can change audio backend (cubeb) in Firefox and Librewolf too, but unfortunately it does not work.

Will try to go deeper :)
 
For both technical and political reasons I won't attempt to watch multimedia inside a browser. It's just bad juju. 1) the in-browser implementations are crappy, and 2) it allows for stuff like DRM and authenticated streaming, both of which I abhore. Even with mainstream stuff like youtube I'll use yt-dlp to download the content and then watch it locally without the intrusive ads.
 
I have a 4K@60Hz video that lags on FreeBSD on Firefox:
View: https://www.youtube.com/watch?v=Hg0Sjh9VMTk


The Stats for Nerds OSD shows drops. I noticed on Linux about a week ago Firefox 138 also had that video lagging, and on Windows it also was laggy with about:support not showing Hardware-accelerated anything. I switched to ESR on Windows and had the HW-accelerated codecs shown and that video working HW fine.

But now I'm on FreeBSD and don't quite know what to do with that video at the moment (modesetting/Intel DDX, both intel-media VAAPI drivers, ESR vs 138, and media.ffmpeg.vaapi.enabled didn't help; OSD said VP9 iirc). I didn't try switching the audio backend yet.

Edit: Forcing alsa didn't work (alsa-lib installed but Firefox doesn't switch to it), but when Firefox can't load a sound driver, the video plays perfectly! Firefox using OSS has something odd going on.

Screenshot_2025-05-17_17-51-06.png
 
There's something odd with OSS?

Firefox 138 and ESR 128 with default OSS lag with this video 4K@60Hz on 14.2-R today (May 18th 2025). Switching to sndio with:

pkg install sndio

service sndiod onestart

Firefox -> about:config -> media.cubeb.backend string to sndio

about:support -> Audio Backend sndio (if it says oss then FF isn't seeing sndiod; it has to say sndio)

Then that video is fine.

Even though onestart works, there's something about having it auto-start in rc.conf that doesn't work (I think timings with the main audio device not present/different path immediately at boot vs a little after).


I use Xfce and just have sndiod (no flags) auto-start through the GUI Session/startup thing for a quick fix, and Firefox fresh profiles auto-default to sndio without needing to manually set media.cubeb.backend.

Edit: I still need to do this 14.3-R-p2 with Firefox 140.2.0esr (2025/08/20) for that 4K@60 video to not drop as-many frames (way-worse hundreds+ oss vs double-digit/low sndio)
 
Last edited:
It's me again. Thank you for such interesting discussion!

Some more thoughts:

1. Recompiling Firefox in two different flavors - ALSA added (with OSS, JACK, SNDIO support too) and with ALSA enabled, everything else disabled, doesn't change anything. Sound is available only with OSS, but video stutters heavily.
2. Same applies to Chromium.
3. Ungoogled Chromium works perfectly out of the box (package installed), after changing audio backed to ALSA.

But all of that seems to be a minor issue, as major one goes into play. During extensive testing etc. I've found that custom Xonar driver with OSS audio subsystem makes the whole system unstable. I've experienced few random crashes (restarts, freezing etc.) during playing audio (using browser or any other audio source). I've never managed to get more than 2 hours uptime while using audio.

Summing this up - just do not choose Xonar D1/DX to be used with FreeBSD. I really appreciate Alexander Polakov efforts, but his driver can't be easily modified to be used with D1/DX. Or I lack knowledge and/or skills to do it properly (yes, that's the main reason I guess).
 
1. Recompiling Firefox in two different flavors - ALSA added (with OSS, JACK, SNDIO support too) and with ALSA enabled, everything else disabled, doesn't change anything. Sound is available only with OSS, but video stutters heavily.
I've had audio play with Jack and Firefox show jack in about:support, but I still had laggy video like OSS with Jack.

Sndio doesn't lag for me and worked with sndiod running (Firefox auto-used it and in about:support). Pkg versions Firefox and ESR (no building/custom options).
 
Back
Top