pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: audio/openal-soft: ALSA backend is broken on NetBSD



On Mon, 17 Jul 2023 at 12:25, PHO <pho%cielonegro.org@localhost> wrote:
>
> Hi,
>
> I found that the ALSA backend of audio/openal-soft is broken on NetBSD
> for three reasons:
>
> 1. It continually spams a message "available samples exceeds the buffer
> size" to stderr but plays no audio at all. This is because
> snd_pcm_avail_update() reports a size larger than that of the ring
> buffer, which makes no sense, is not a documented behavior, but is
> apparently not a bug according to the mo********ing codebase of
> audio/alsa-lib. Removing the following lines makes it play the audio as
> expected:
>
>    alc/backends/alsa.cpp:486:
>    >        if(avail > buffer_size)
>    >        {
>    >            WARN("available samples exceeds the buffer size\n");
>    >            snd_pcm_reset(mPcmHandle);
>    >            continue;
>    >        }
>
>    alc/backends/alsa.cpp:568:
>    >         if(static_cast<snd_pcm_uframes_t>(avail) > buffer_size)
>    >         {
>    >             WARN("available samples exceeds the buffer size\n");
>    >             snd_pcm_reset(mPcmHandle);
>    >             continue;
>    >         }
>
> 2. But even if you remove lines mentioned above, int
> AlsaPlayback::mixerProc() in alc/backends/alsa.cpp does some kind of
> busy loop all the time and wastes CPU time for no reason.
>
> 3. The busy loop in mixerProc() refuses to exit on shutdown.
> Applications using OpenAL cannot exit gracefully, because the backend
> ignores the shutdown request.
>
> So I think it's better to disable the ALSA backend on this platform,
> especially since the SunAudio backend works perfectly, and even more so
> thanks to the in-kernel mixer. I mean I propose the following change to
> the package. Do you have any opinions?
>
> --- options.mk  30 Nov 2019 13:40:29 -0000      1.1
> +++ options.mk  17 Jul 2023 11:21:34 -0000
> @@ -1,9 +1,16 @@
>   # $NetBSD: options.mk,v 1.1 2019/11/30 13:40:29 nia Exp $
>
>   PKG_OPTIONS_VAR=               PKG_OPTIONS.openal-soft
> -PKG_SUPPORTED_OPTIONS=         alsa jack pulseaudio
> +PKG_SUPPORTED_OPTIONS=         jack pulseaudio
>   PKG_SUGGESTED_OPTIONS.Linux+=  alsa
>
> +.include "../../mk/bsd.prefs.mk"
> +
> +.if ${OPSYS} != "NetBSD"
> +# The ALSA backend is broken on this platform. Don't use it.
> +PKG_SUPPORTED_OPTIONS+=        alsa
> +.endif
> +
>   .include "../../mk/bsd.options.mk"
>
>   .if !empty(PKG_OPTIONS:Malsa)

I would suggest a PR to cover the issue, then mention it in the comment

David


Home | Main Index | Thread Index | Old Index