Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenAL randomly stops playing some sounds, can only fix with reboot

THE APPS: Two Cocos2d universal iOS games with a large customer base.

THE PROBLEM: Several months back (in 2011) reports started coming in, sounds would randomly cut out, only some of the sounds would play in the app, others wouldn’t. This problem can ONLY be fixed by a device reboot.

IMPORTANT NOTES & DETAILS:

  • The SAME code and SAME sound files played fine for over a year with NO bug reports of this sort. I wish I could pinpoint a date, but I believe the problem started with an iOS update.

  • The bug is incredibly hard to reproduce. I have personally seen it once, but I have had no luck causing it again. Yet we get 1-2 support emails a day with the same issue, some of which come in the form a bad reviews. If I had to pull a number out of the air, I’d guess we’re looking at a 1 in 1000 incidence. It seems maybe more common on the iPad, but I’m not sure.

  • Restarting the device is the ONLY way to fix the problem. Restarting the app does nothing, deleting the app and reinstalling does nothing, has to be a power down and turn back on.

  • A few weeks ago in an attempt to blindly fix I dumped the Cocos2d Sound engine and switched one of the apps over to ObjectAL (another openAL based sound engine), hoping it might have fixed the problem. It did not, same issue is occurring. As you'd note, both of these are just interfaces for OpenAL.

  • The sound files themselves were converted from wavs to cafs using Apple’s recommend method ( https://developer.apple.com/library/ios/#codinghowtos/AudioAndVideo/_index.html ), although we also used the -c 1 flag to make them single channel.

  • Just to be clear, the bug has nothing to do with the usual sound issues (mute switch, volume). A portion of the sounds continue playing fine, but they will never all play again until the device is powered down and restarted.

If anyone has any ideas I’d all, I’d be very grateful for the help. I’m at wits end here trying to fix a persistent bug I can’t recreate and that appears to be caused by something outside my control.

like image 947
peter Avatar asked Feb 22 '12 15:02

peter


1 Answers

I've had similar problems with OpenAL, as the commenters stated. We had spurious problems on different hardware and on different OS releases. Really, it was nearly impossible to reproduce. The only reason we even found out about the problem was the significant percentage of users who experienced crashes or other severe audio problems. We tried for months trying to make it work, but in the end the stability problems we experienced just weren't manageable. We ended up going with another library and took OpenAL completely out of the picture. I certainly would not recommend it for new projects.

like image 93
Brett Avatar answered Nov 16 '22 03:11

Brett