Re: AudioFileClose() crashing on iOS after playback
Re: AudioFileClose() crashing on iOS after playback
- Subject: Re: AudioFileClose() crashing on iOS after playback
- From: Doug Wyatt <email@hidden>
- Date: Mon, 4 Oct 2010 12:06:12 -0700
Chris, what you're describing with your handling of the URL seems correct to me.
Just to be sure, there's no chance that you are releasing it twice? Are you passing audioFileURL to any other functions?
If you're sure it's not being released more than once, to help us investigate, what kind of file is being opened? What version of Mac OS or iOS are you running?
thanks
Doug
On Oct 2, 2010, at 15:54 , Chris Santoro wrote:
> Thanks Brian, I certainly do need to brush up on my Core Foundation Memory Management concepts (I live in the world of plain-asm/C/C++ most of the time), but here's a concrete example of that I'm doing:
>
> I want to start playing a file given some CFString theFilePath which I do not own. I want to use AudioFileOpenURL, so I first I create a URL.
>
> CFURLRef audioFileURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, theFilePath, kCFURLPOSIXPathStyle, false);
>
> Then I open the audio file, where mPlaybackFile is a member of the class that's currently doing all this.
>
> AudioFileOpenURL (audioFileURL, kAudioFileReadPermission, 0, &mPlaybackFile);
>
> I've got my file handle (mPlaybackFile), and now (I think) I don't need the URL I used to open the file. So I release it.
> CFRelease(audioFileURL);
>
> Then I play the file back, hit the end of the file and want to stop now, so I stop the output AU, and close the file.
>
> AudioFileClose(mPlaybackFile);
>
> As is, I get a bad access crash on AudioFileClose(). If I comment out the release of the URL, I don't get the crash. Was it wrong of me to assume that I didn't need that URL anymore?
>
> Best,
> Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden