Closed gttmnn closed 3 years ago
This bug is related to how often the garbage collector dispatch source runs, which by default is once every 10 seconds. To fix it the collector needs to run more often or have the ability to be signaled on demand (perhaps via a semaphore). I will look into a fix.
I've created an experimental fix at https://github.com/sbooth/SFBAudioEngine/tree/collector-thread
That was blazing fast, thank you very much. I did some quick testing and it all seems to work with the fix, amazing.
I'm glad it's working for you now.
I reworked the code to use a dispatch source instead of a a dedicated thread. In theory this should decrease the overhead.
Not sure what I am doing wrong but it seems like the decoder queue is not cleared correctly when playing tracks. This shows up in the log when the problem is about to happen:
No open slots in _decoderStateArray
The result is that the playback is stopped and the requested track might or might not play.
The problem can be reproduced in the
SimplePlayer-macOS
example project by loading a file and then double-clicking the playlist item multiple times to play it again and again. It does not seem to happen when tracks are played sequentially, so it seems to be tied to how "fast" tracks are queued and played.Full log output: output.txt
macOS 10.15.7 Xcode 12.3