I’ve a serious issue with the update function:
I’m working on a FMOD implementation of a game sound library. This lib stream all sound by itself so i create all sounds on fmod with createStream and OPEN_USER flag, and fill sound data inside a read callback passed in fmod sound parameters.
This just work fine (except some minor latency).
After 20-25 min of playtest, the fmod thread just crash (access violation). So i though about some multi thread memory problem on my side and decide to critical section my callback just to prevent any problem.
At this point my problem raise : instead crashing, the fmod system update function do not want to finish ! Frozing my main thread (All others threads still running just fine, and there no wait for some critical section to release).
Debuggin disassembly give me than a small section of the function loop forever.
I know this is just weird but any suggestion about this ? It just drive me crazy <_<
- kweee asked 5 years ago
This is inside the main thread but have been issues with people trying to clean up sound objects using Sound::release inside this callback but it doesn’t sound like you’re doing that here.
This is called from the mixer thread and can cause race conditions but it sounds like you’re code is threadsafe.
From the information you have provided it sounds like you’re doing everything right. It’s hard for me to diagnose the problem, everything sounds quite standard. Would you be able to try to reproduce the issue outside your engine by modifiying one of the examples and send it to email@example.com?
Thanks for your time ^^
1: nope i’m calling fmod only from my main thread
I’m using a channel callback, with nearly no code : a switch to catch FMOD_CHANNEL_CALLBACKTYPE_END, and inside this case, a channel->getUserData followed by an atomic operation on my data if function result FMOD_OK
And a FMOD_CREATESOUNDEXINFO.pcmreadcallback with following code :
channel->getUserData give my sound object.
i take my buffer from a queue thread safe on this object
then memcopy my buffered data on fmod void* data (with the right size and checks)
(here i’ve put some critical section to be sure)
3: no deadlock possible from this critical (and also, when freezing, criticals sections are not involved)
Please login first to submit.