Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wav playback broken? #15

Open
isalkind opened this issue Aug 20, 2010 · 7 comments
Open

wav playback broken? #15

isalkind opened this issue Aug 20, 2010 · 7 comments

Comments

@isalkind
Copy link

With the latest iteration (Mac or iPhone), wav playback terminates with EXC_BAD_ACCESS.
The following appears in the debugger console preceding the termination: "Queueing of audio buffer failed. err: ˇˇˇŒ -50"

I have an older version with an AudioStreamer.m dated March 10, 2010 that plays back wav just fine.

I'll search for a resolution as time permits, but streaming audio is not my forte.

@isalkind
Copy link
Author

Broke between the Nov 24, 2009 checkpoint and the Mar 29, 2010 checkpoint.

@ghassett
Copy link

I am having this exact same problem -- MP3's play, but WAV's cause the app to crash.

I am working through the code in the debugger but cannot yet figure out why AudioQueueEnqueueBuffer returns -50 as an error on line 1372 of AudioStreamer.m.

Anyone have any suggestions? Here's where err comes back as -50:


if (packetsFilled)
{
    err = AudioQueueEnqueueBuffer(audioQueue, fillBuf, packetsFilled, packetDescs);
}
else
{
    err = AudioQueueEnqueueBuffer(audioQueue, fillBuf, 0, NULL);
}
        
if (err)
{
    [self failWithErrorCode:AS_AUDIO_QUEUE_ENQUEUE_FAILED];
    return;
}

@isalkind
Copy link
Author

I did come up with a fix for this problem. If I recall correctly it had something to do with how VBR vs non-VBR streams are handled. Give me a chance to look at my changes and I will post later in the day.

@ghassett
Copy link

Wow, thank you so much for your speedy response. Looking forward to the fix. I found a version of AudioStreamer that DOES in fact play WAV files (it's an older version of your code, without your other improvements). I stepped through the code for both and am completely baffled why one works and the other doesn't, because they both appear to be calling into the audio framework in exactly the same way. I really appreciate your help and your work -- thank you.

@isalkind
Copy link
Author

I forked the repository and committed my changes. You can find them in the 'isalkind' branch. Only touched the AudioStreamer.h & AudioStreamer.m files. Certain calculations assumed VBR. These changes try to detect when something is non-VBR (CBR) and make calculations appropriately.

Although the changes should work for other non-VBR streams, I have only tested them specifically with wav streams. Your millage may vary.

@ghassett
Copy link

Great fix, life is good. Thank you very, very much.

@bhavinb
Copy link

bhavinb commented Feb 18, 2011

Faced the same issue and used fixed version of the streamer provided by isalkind. Wav streaming works great now. Thanks isalkind!!

Bo98 referenced this issue in Bo98/AudioStreamer Sep 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants