mattgallagher / AudioStreamer

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

Undefined deadlock #60

Closed zarcon closed 11 years ago

zarcon commented 11 years ago

Hello. Sorry for my English.

I try to write Stream Playe. And i use your library, thanks for that very much.

All be okey for some time. But tomorrow i play one track - (you can try - http://z-media.su/fbc94025c81b.mp3 )

buffering for few seconds and deadlock! When i pause simulator, debugger show on @synchronized block in "progress" method.

This problem not only in my app, but and with your example app :(

21-02-2013

zarcon commented 11 years ago

btw, if i define kNumAQBufs as 8, all ok with this track, but have some problems with others :(

mattgallagher commented 11 years ago

Hi,

If you replace the start of the handlePropertyChangeForQueue:propertyID: method with the following code (leaving the @synchronized and everything below in place), this will avoid the deadlock:

// // handlePropertyChangeForQueue:propertyID: // // Implementation for ASAudioQueueIsRunningCallback // // Parameters: // inAQ - the audio queue // inID - the property ID //

But this will not fix your problem with the kNumAQBufs value. The way that AudioStreamer works requires the audio buffers to be filled before playback starts. Your MP3 file is too small to fill the buffers so playback will fail. You would need to edit the code to play smaller numbers of buffers if the end-of-file is reached before the buffers are filled. You would need to work out how to do this yourself (I do not know where you would need to start).

Regards, Matt Gallagher.

On 21/02/2013, at 6:17 PM, zarcon notifications@github.com wrote:

btw, if i define kNumAQBufs as 8, all ok with this track, but have some problems with other :(

— Reply to this email directly or view it on GitHub.

zarcon commented 11 years ago

Thanks for the enlightenment, Matt, I will try