[Bug 274047] audio/alsa-plugins: large number of underruns and CPU usage with games/veloren-weekly

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 23 Sep 2023 14:50:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274047

            Bug ID: 274047
           Summary: audio/alsa-plugins: large number of underruns and CPU
                    usage with games/veloren-weekly
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: scf@FreeBSD.org
                CC: games@FreeBSD.org, jbeich@FreeBSD.org
                CC: games@FreeBSD.org, jbeich@FreeBSD.org

I am uncertain which is at fault (or both), but I noticed that Veloren runs at
a high CPU with many ALSA underruns.  It also caused visual and auditory
stuttering.

The CPU can be observed by running Veloren in a single world game then
suspending it by opening the menu to remove game activities.  On my system, the
CPU usage hovers around 70%.

The process will output many of these messages:

    ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred

The underruns can be verified via /dev/sndstat with hw.snd.verbose=2.

To reduce the CPU usage to below 10% (on my system again) and greatly reduce
the underruns, I decreased the value of ALSA_OSS_BUFSZ_MAX in
audio/alsa-plugins/files/patch-oss_pcm__oss.c from 131072 to 16384.  32768
appeared to be the maximum value that could be used without underruns.

I am not sure if this is the best decision or not, but it fixed Veloren for me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.