kcat / openal-soft

OpenAL Soft is a software implementation of the OpenAL 3D audio API.
Other
2.2k stars 532 forks source link

OpenAL-1.19.1 error: AL lib: (EE) ALCplaybackAlsa_mixerProc #337

Closed dirteat closed 4 years ago

dirteat commented 5 years ago

Hi there, I am encountering a loss of some sounds with the great open source flight simulator FlightGear. I am posting the issue here because it only occurs when flightgear is compiled against openal-1.19.1 while everything was fine with the previous versions I had tested, 1.17.*

The only error message I can read when some of the sounds disappear is:

AL lib: (EE) ALCplaybackAlsa_mixerProc: mmap commit error: Broken pipe

I'll appreciate any advice to debug this, and I'll be happy to do more tests if required.

Thanks, Cheers, Chris.

kcat commented 5 years ago

That message would suggest the device is underrunning while mixing. How often does it happen? Are there any other error messages with it? Can you provide a trace log (set the ALSOFT_LOGLEVEL environment variable to 3 when you run the app)?

dirteat commented 5 years ago

Thanks for the answer. It happens rationally at always the same point within the game, the sound of the engine disappears while various other sounds within the cockpit keep on working, like touching the switches produce sound (I've first been in touch with the flightgear dev, and he did not change anything as far as the sound is concerned).

I have run a session with ALSOFT_LOGLEVEL=3, a lot of initialization messages appear, but nothing more at the time the engine sound disappears. I have also tried with mmap=0 within /etc/openal/alsoft.conf, no change.

The init logs of the run with mmap=0

AL lib: (II) Initializing library v1.19.1-unknown UNKNOWN AL lib: (II) Supported backends: jack, pulse, alsa, sndio, oss, port, null, wave AL lib: (II) Loading config /etc/openal/alsoft.conf... AL lib: (II) found 'alsa/mmap' = '0' AL lib: (II) Loading config /etc/xdg/alsoft.conf... AL lib: (II) Loading config /home/chris/.alsoftrc... AL lib: (II) Loading config /home/chris/.config/alsoft.conf... AL lib: (II) Got binary: /usr/bin, fgfs AL lib: (II) Loading config /usr/bin/alsoft.conf... AL lib: (II) Key disable-cpu-exts not found AL lib: (II) Detected max CPUID function: 0xd (ext. 0x80000008) AL lib: (II) Vendor ID: "" AL lib: (II) Name: " Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz" AL lib: (II) Extensions: +SSE +SSE2 +SSE3 +SSE4.1 AL lib: (II) Key rt-prio not found AL lib: (II) Key resampler not found AL lib: (II) Key trap-al-error not found AL lib: (II) Key trap-alc-error not found AL lib: (II) Key reverb/boost not found AL lib: (II) Key drivers not found AL lib: (WW) Failed to load jack_errorcallback: /lib64/libjack.so.0: undefined symbol: jack error_callback AL lib: (II) Key jack/spawn-server not found AL lib: (WW) Cannot connect to server socket err = No such file or directory AL lib: (WW) Cannot connect to server request channel AL lib: (WW) jack server is not running or cannot be started AL lib: (WW) JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unloc k AL lib: (WW) JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unloc k AL lib: (WW) jack_client_open() failed, 0x11 AL lib: (WW) Failed to initialize backend "jack" AL lib: (II) Key pulse/spawn-server not found AL lib: (WW) Failed to initialize backend "pulse" AL lib: (II) Initialized backend "alsa" AL lib: (II) Added "alsa" for playback AL lib: (II) Added "alsa" for capture AL lib: (II) Key excludefx not found AL lib: (II) Key default-reverb not found AL lib: (II) Key alsa/device not found AL lib: (II) Key alsa/custom-devices not found AL lib: (II) Key alsa/device-prefix not found AL lib: (II) Key alsa/device-prefix-PCH not found AL lib: (II) Key alsa/device-prefix-PCH-0 not found AL lib: (II) Got device "HDA Intel PCH, ALC1150 Analog (CARD=PCH,DEV=0)", "plughw:CARD=PCH,DEV=0" AL lib: (II) Key alsa/device-prefix-PCH-1 not found AL lib: (II) Got device "HDA Intel PCH, ALC1150 Digital (CARD=PCH,DEV=1)", "plughw:CARD=PCH,DEV=1" AL lib: (II) Key alsa/device-prefix-NVidia not found AL lib: (II) Key alsa/device-prefix-NVidia-3 not found AL lib: (II) Got device "HDA NVidia, HDMI 0 (CARD=NVidia,DEV=3)", "plughw:CARD=NVidia,DEV=3" AL lib: (II) Key alsa/device-prefix-NVidia-7 not found AL lib: (II) Got device "HDA NVidia, HDMI 1 (CARD=NVidia,DEV=7)", "plughw:CARD=NVidia,DEV=7" AL lib: (II) Key alsa/device-prefix-NVidia-8 not found AL lib: (II) Got device "HDA NVidia, HDMI 2 (CARD=NVidia,DEV=8)", "plughw:CARD=NVidia,DEV=8" AL lib: (II) Key alsa/device-prefix-NVidia-9 not found AL lib: (II) Got device "HDA NVidia, HDMI 3 (CARD=NVidia,DEV=9)", "plughw:CARD=NVidia,DEV=9" AL lib: (II) Key alsa/device-prefix-C525 not found AL lib: (II) Key alsa/device not found AL lib: (II) Opening device "default" AL lib: (II) Key channels not found AL lib: (II) Key sample-type not found AL lib: (II) Key frequency not found AL lib: (II) Key period_size not found AL lib: (II) Key periods not found AL lib: (II) Key sources not found AL lib: (II) Key slots not found AL lib: (II) Key sends not found AL lib: (II) Key ambi-format not found AL lib: (II) Created device 0x33743810, "ALSA Default" AL lib: (II) Key hrtf not found AL lib: (II) Pre-reset: Stereo, Float, 44100hz, 882 / 2646 buffer AL lib: (II) Found alsa/mmap = "0" AL lib: (II) Key alsa/allow-resampler not found AL lib: (II) Post-reset: Stereo, Float, 48000hz, 1024 / 3072 buffer AL lib: (II) Key stereo-mode not found AL lib: (II) Key cf_level not found AL lib: (II) Key stereo-encoding not found AL lib: (II) Stereo rendering AL lib: (II) Channel config, Main: 3, Real: 2 AL lib: (II) Allocating 5 channels, 20480 bytes AL lib: (II) Enabling first-order ambisonic decoder AL lib: (II) Max sources: 256 (255 + 1), effect slots: 64, sends: 2 AL lib: (II) Front stablizer disabled AL lib: (II) Key dither not found AL lib: (II) Key dither-depth not found AL lib: (II) Dithering disabled AL lib: (II) Key output-limiter not found AL lib: (II) Output limiter disabled AL lib: (II) Fixed device latency: 0ns AL lib: (II) Key volume-adjust not found AL lib: (II) Created context 0x31a77020

kcat commented 5 years ago

Well, the engine sound alone disappearing shouldn't have anything to do with the AL lib message. That message just means there was an underrun in the device's output, but the playback state of the individual sounds are separate from that (if the device playback underruns, OpenAL Soft resumes everything right where it left off).

The engine sound stopping would have to be another issue, the game is either stopping it prematurely for some reason, or if it's a buffer queue, it's running out and isn't properly restarted. I'd have to see its code to hope to figure out what it may be.

dirteat commented 5 years ago

Thank you for the explanations. I'll try to provide more information to debug this then, when I'll be able to understand more on the issue. In the meanwhile, the source code of flightgear sound implementation is here:

https://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/sound/

I have noticed that when some of the sounds disappear, listening carefully with headphones, I can still hear some very low level clicks at the expected times the sounds should pop in and pop out (I have visuals for engines on/off in the cockpits allowing me to make this statement). And after a while, suddenly all the sounds are getting back, then the same sets of sound disappear again to let place to this very low volume ticks.

It 's really a mess to debug :(

kcat commented 5 years ago

Hmm. At a short glance, I don't notice anything there that would cause the sound to end prematurely. The only real bug I notice is when loading an IMA4 format sound, it sets the block alignment after loading the buffer data (so it loads with the wrong alignment, which would usually result in that sound failing to load since the data size would be invalid, or otherwise sound like a complete mess, unless it just happens to use the default alignment). But that would affect the sound from the beginning, not make it suddenly cut out.

There's no streaming with the openal manager, so it's not underrunning a buffer queue, and it seems to be properly checking that a source is playing. It would have to be somewhere else than the openal-specific code. I can only guess it's either a general non-openal-specific issue, or an issue with the way the higher level sound code interacts with the openal manager.

kcat commented 4 years ago

Does it still happen with 1.20.1? Is there still the "Broken pipe" error message?

dirteat commented 4 years ago

Well, for the time being, I cannot compile the new version, got some conflicts in SDL include, it is hundred of them :-/

In file included from /usr/include/SDL2/SDL_audio.h:31, from /home/eatdirt/repos/openal/BUILD/openal-soft-1.20.1/examples/allatency.c:31: /usr/include/SDL2/SDL_stdinc.h:163:5: error: redeclaration of enumerator ‘SDL_FALSE’ SDL_FALSE = 0, ^~~~~ In file included from /usr/include/SDL/SDL_main.h:26, from /usr/include/SDL/SDL.h:30, from /usr/include/SDL/SDL_sound.h:67, from /home/eatdirt/repos/openal/BUILD/openal-soft-1.20.1/examples/allatency.c:30: /usr/include/SDL/SDL_stdinc.h:94:2: note: previous definition of ‘SDL_FALSE’ was here SDL_FALSE = 0,

kcat commented 4 years ago

Unless you need the examples, you can disable them by passing -DALSOFT_EXAMPLES=FALSE to cmake. To work, SDL_sound needs to be built against SDL2, and the SDL1 headers must not exist. Though it seems at least Debian doesn't provide packages for this, so SDL_sound has to be built manually with SDL2 in place of SDL1.

I'm probably going to have to drop SDL_sound support for the examples since it keeps causing this issue, and find something else. It's just unfortunate since there isn't another widely-available open source library that can load wavs, oggs (vorbis, flac, etc), and mp3s through a simple API.

dirteat commented 4 years ago

Thanks for the info, did compile SDL_sound with SDL2, works fine.

Concerning the question, no, I don't see any more any Broken Pipe error messages.

Concerning my original issue, unfortunately, still the same sound disappearance in flightgear (only versions of openal 1.17.* were working for me). Someone reported the same issue within flightgear in a totally different context (see above bunnyhappy). Very difficult to debug, only part of some sound goes away, and come back and forth.

kcat commented 4 years ago

Unfortunately I can't see anything wrong on OpenAL Soft's side about just those sounds disappearing. The above-referenced issue seems to indicate it was a problem with Apple's OpenAL on Mac causing a failure to play, and certainly OpenAL Soft wouldn't give error strings like "Unknown Internal Error".

You'll need to figure out what calls are being made that causes those sounds to stop. At least for a looping source, OpenAL won't end it on its own; the app would have to call to pause/stop/rewind or delete the source for it to stop.

dirteat commented 4 years ago

Let me close this one, we finally solved it on the flightgear's side.

In fact, it was a bad interference with that commit: https://github.com/kcat/openal-soft/commit/c234b25ac7ace092867cc3348e7ea2b2754a7284

flightgear was working around old implementation of the Doppler effect (version < 1.18.0), which was not updated to your better implementation! Thanks for the help since then! Cheers.