AVAudioPlayer interrupting playback with audioPlayerDecodeErrorDidOccur, with NSOSStatusErrorDomain -50

StackOverflow https://stackoverflow.com/questions/4378633

Question

In very specific, but reproducible cases, I'm getting audioPlayerDecodeErrorDidOccur:error: with the following NSError:

Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)"

This occurs in a game that also uses OpenAL; we're playing sounds using OpenAL, but attempting to leverage hardware AAC decoding. However, the occurence of the above does not appear linked to anything we do in OpenAL.

This happens about 2-3 seconds after we perform scene (game mode) switching -- but only with certain combinations of from-and-to scenes. It is even stranger since we do nothing important audio related on these events. I've verified that we do nothing with AVAudioPlayer, but it doesn't seem that anything important is done with OpenAL either.

I've tried to resolve this by releasing the AVAudioPlayer, and replacing it with another one that references the same file, uses the same volume and resumes from the same time in the file. However, after a few seconds, this player also throws the aforementioned error. Switching to a new song, on the other hand, creates a fully functional player, that does not have any problems.

My question is: what does error -50 mean in this context, or how would you go about figuring out what it means?

(If it means anything, the game must run at minimum on iOS 3.1.2).


We have tried disabling OpenAL part of the code; it did not help.

Audio library code is publicly available at http://libxal.svn.sf.net/svnroot/libxal/trunk/

Was it helpful?

Solution

We managed to mess up something on the C++ level. This probably caused memory corruption in AVAudioPlayer without actually crashing the game, and behaving the same on the Simulator and the device. We fixed this and the AVAudioPlayer now works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top