mattgallagher / AudioStreamer

A streaming audio player class (AudioStreamer) for Mac OS X and iPhone.
http://cocoawithlove.com
1.93k stars 553 forks source link

Random AS_AUDIO_QUEUE_CREATION_FAILED error. #32

Closed r3econ closed 1 year ago

r3econ commented 13 years ago

As others probably noticed AudioStreamer often fails with AS_AUDIO_QUEUE_CREATION_FAILED error. However, starting the streamer again is almost always successful. Error appears when we try to create new output for the audio que:

// create the audio queue

err = AudioQueueNewOutput(&asbd, MyAudioQueueOutputCallback, self, NULL, NULL, 0, &audioQueue);

if (err){

self failWithErrorCode:AS_AUDIO_QUEUE_CREATION_FAILED]; return; }

I tried to wait after an error using [NSThread sleepForTimeInterval:2] and then firing AudioQueueNewOutput() again, however it does not fix the issue and streamer failes again with AS_AUDIO_QUEUE_CREATION_FAILED. Furthermore, logging the error using:

NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil]; NSLog(@"Error: %@", [error description]);

shows that: Error: Error Domain=NSOSStatusErrorDomain Code=560360820 "The operation couldn’t be completed. (OSStatus error 560360820.)"

Which tells me nothing since in Apple's documentation there is no such a error code and googling it shows 2 or 3 developers that encountered that behaviour but did not manage to fix it.

Any help will be appreciated. Cheers!