Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#297 closed defect (fixed)

alSourceUnqueueBuffers fails with "invalid value"

Reported by: Jan Wassenberg Owned by:
Priority: Should Have Milestone:
Component: Core engine Keywords: snd_mgr
Cc: Patch:

Description

This has been reported on two Linux systems, both running OpenALsoft. To narrow down the cause, I added some printfs [source ID, is it a valid source name, #processed buffers]:

ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
ade7938 1 0
adcede0 1 1

so the first time it's actually wanting to unqueue a buffer, OpenAL reports an error. After continuing from the error, it doesn't come up again during the program run.

alSourceUnqueueBuffers fails with "invalid value" iff a buffer cannot be unqueued because it's still playing. However what we do is ask how many buffers have finished before removing exactly that many. I have no idea what could be causing this, especially because the Windows OpenAL implementation does not raise this error. Help is very welcome.

Attachments (2)

openal.trace (296.4 KB ) - added by Philip Taylor 15 years ago.
output from ltrace -C -l /usr/lib/libopenal.so ./pyrogenesis_dbg
annotated_trace.txt (3.4 KB ) - added by Jan Wassenberg 15 years ago.

Download all attachments as: .zip

Change History (7)

by Philip Taylor, 15 years ago

Attachment: openal.trace added

output from ltrace -C -l /usr/lib/libopenal.so ./pyrogenesis_dbg

comment:1 by Jan Wassenberg, 15 years ago

Thanks for the trace! That's very useful, unfortunately I didn't see anything suspicious, though. I've passed this on to the openal-devel mailing list.

by Jan Wassenberg, 15 years ago

Attachment: annotated_trace.txt added

comment:2 by Jan Wassenberg, 15 years ago

Update: I've boiled down the trace to the mostly important parts (see annotated trace.txt above), which has revealed a problem. The same OpenAL source is reused after stopping it and wiping out its buffer queue. This is legitimate and desirable (creating sources may be expensive), but OpenALsoft doesn't appear to handle the case correctly where the old source was set to looping and therefore had unprocessed buffers.

comment:3 by Jan Wassenberg, 15 years ago

Resolution: fixed
Status: newclosed

(In [7111]) # fix sound error on Linux Linux OpenALsoft implementations weren't resetting source state correctly when stopping/clearing buffer queue, leading to errors when the source was reused. workaround: use 'rewind' to ensure the buffer state is updated. closes #297 (please reopen if the problem persists)

comment:4 by Jan Wassenberg, 14 years ago

(In [7516]) work around sound-related deadlock and assert on exit (due to OS X's broken OpenAL implementation) refs #297

comment:5 by (none), 14 years ago

Milestone: Open Source Release

Milestone Open Source Release deleted

Note: See TracTickets for help on using tickets.