Re: AudioFileClose() crashing on iOS after playback
Re: AudioFileClose() crashing on iOS after playback
- Subject: Re: AudioFileClose() crashing on iOS after playback
- From: William Stewart <email@hidden>
- Date: Tue, 12 Oct 2010 17:49:58 -0700
This is the basic pattern of code that we use in our sample code and in afinfo. So, this should not crash.
So, I would not expect there to be a problem with this code. Doug had suggested looking to see if you are over-releasing the URL, so that is an area you can investigate. Also, what file type is it? Does it happen with all file types or just that one, and if not, does it happen with other files of this type, or just this one. If you think this is a bug in the AudioFile code, please file a bug and attach the file that triggers the problem
Thanks
Bill
On Oct 2, 2010, at 3:54 PM, 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