• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ExtAudioFileRead Crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExtAudioFileRead Crash


  • Subject: Re: ExtAudioFileRead Crash
  • From: Hendrik Schreiber <email@hidden>
  • Date: Mon, 12 Oct 2009 09:50:53 +0200

Hi Peter,

I think I've started seeing this one too, when handing it an ABL that didn't fit exactly.

E.g. at the end of an audio file, the buffer would be shorter than the number of frames I attempt to read, knowing that the file is actually shorter than the number of frames I requested.

To illustrate, here's a totally made up example:

Your decoded file is 6kb.
Your ABL buffer is 6kb.
You read in blocks of 4kb and move the pointer to your buffer after each read.
So the first read is fine, now you move the pointer by 4kb.
In the second you again ask for 4kb, even though your ABL buffer has only 2kb left. This should still work, because you know, that you only need 2kb. However, when asking for 4kb you get the crash, because Core Audio checks your buffer sizes.


It's a while ago and it might behave differently, so no guarantees.

In any case, make sure your buffersize fits the frames you are trying to read and you should be fine.

Hope this helps,

-hendrik


On Oct 11, 2009, at 16:31 , Peter Castine wrote:

Hello,

I have an app that is running on Leopard pretty happily but crashes regularly on Snow Leopard immediately after starting audio, which involves soundfile playback.

There was a thread end of August that looks similar to my problem but was never resolved for lack of Crash Log etc. I'll provide a log extract below.

If I may start with a general observation & question: the app crashes in ExtAudioFileRead(). The API documents warn the function isn't entirely thread-safe. My code (some of which is inherited from other parties) is, as far as I have to date determined, only calling ExtAudioFileRead() from only one thread. We can be mixing and playing back multiple soundfiles, but the reads are serialized and from a single thread.

However, from the crash log it looks like more than one thread is calling ExtAudioFileRead(). Is this likely to be a result of Snow Leopard's "Grand Central Dispatch" multi-core automated multi- threading facility?

If this is the case, what are my options? I see (a) using the lower- level Audio File Services and (b) delving into GCD documentation to figure out how to prevent GCD from clobbering my app.

Before starting either of these routes, it would be helpful to be sure I'm barking up the right tree. If one of the options (or another I haven't thought of) would be a clear path-of-least- resistance, that would be great to know. If the answer is (b) above then I'll take further questions to another list, but right now this appears to be in the first instance a CoreAudio question.

Log extract below, ttboma the relevant parts. If someone would like to look at the full 60kB, perhaps better by direct mail. I can also provide code, but it's a big enough app and stripping down the code is enough work that I'd like to know someone really wants to see it.

Thanks
-- Peter

----
Code Type:       X86 (Native)
OS Version:      Mac OS X 10.6.1 (10B504)

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000be1724fc

Thread 21 Crashed:
0 ....audio.toolbox.AudioToolbox 0x9918e651 CrashIfClientProvidedBogusAudioBufferList + 73
1 ....audio.toolbox.AudioToolbox 0x991e19fa ExtAudioFileRead + 66
2 ...coustic.myApp 0x0000c0e0 ChunkReadCallback + 260
3 ...coustic.myApp 0x00017b0f WorkerThreadStartFunc + 63
4 libSystem.B.dylib 0x9838cf39 _pthread_start + 345
5 libSystem.B.dylib 0x9838cdbe thread_start + 34


Thread 42:
0 ....audio.toolbox.AudioToolbox 0x99193c44 Resampler2::ConvertAltivec_SmallIntegerRatio(float*, float*, unsigned long, int) + 682
1 ....audio.toolbox.AudioToolbox 0x99193551 Resampler2::PushConvert(float*, float*, float*, float*, unsigned long&, unsigned long&, unsigned long, unsigned long) + 559
2 ....audio.toolbox.AudioToolbox 0x9919306f Resampler2Wrapper::RenderOutput(CABufferList*, unsigned long, unsigned long&) + 535
3 ....audio.toolbox.AudioToolbox 0x9918e7ab BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) + 315
4 ....audio.toolbox.AudioToolbox 0x9918e913 AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) + 157
5 ....audio.toolbox.AudioToolbox 0x9918e7ab BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) + 315
6 ....audio.toolbox.AudioToolbox 0x9918e520 AudioConverterFillComplexBuffer + 268
7 ....audio.toolbox.AudioToolbox 0x991ead84 ExtAudioFile::Read(unsigned long&, AudioBufferList*) + 700
8 ....audio.toolbox.AudioToolbox 0x991e1a0d ExtAudioFileRead + 85
9 ...coustic.myApp 0x0000c0e0 ChunkReadCallback + 260
10 ...coustic.myApp 0x00017b0f WorkerThreadStartFunc + 63
11 libSystem.B.dylib 0x9838cf39 _pthread_start + 345
12 libSystem.B.dylib 0x9838cdbe thread_start + 34


Thread 60:
0 ....audio.toolbox.AudioToolbox 0x9918f2e4 NativeInt16ToFloat32_X86 + 268
1 ....audio.toolbox.AudioToolbox 0x9918f1c4 PCMConverter2::ConvertBufferList(unsigned long, CABufferList const*, CABufferList*) + 96
2 ....audio.toolbox.AudioToolbox 0x9918ea39 CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) + 185
3 ....audio.toolbox.AudioToolbox 0x9918e7ab BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) + 315
4 ....audio.toolbox.AudioToolbox 0x9918eb1e BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&, CABufferList const*&) + 160
5 ....audio.toolbox.AudioToolbox 0x99192f28 Resampler2Wrapper::RenderOutput(CABufferList*, unsigned long, unsigned long&) + 208
6 ....audio.toolbox.AudioToolbox 0x9918e7ab BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) + 315
7 ....audio.toolbox.AudioToolbox 0x9918e913 AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) + 157
8 ....audio.toolbox.AudioToolbox 0x9918e7ab BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) + 315
9 ....audio.toolbox.AudioToolbox 0x9918e520 AudioConverterFillComplexBuffer + 268
10 ....audio.toolbox.AudioToolbox 0x991ead84 ExtAudioFile::Read(unsigned long&, AudioBufferList*) + 700
11 ....audio.toolbox.AudioToolbox 0x991e1a0d ExtAudioFileRead + 85
12 ...coustic.myApp 0x0000c0e0 ChunkReadCallback + 260
13 ...coustic.myApp 0x00017b0f WorkerThreadStartFunc + 63
14 libSystem.B.dylib 0x9838cf39 _pthread_start + 345
15 libSystem.B.dylib 0x9838cdbe thread_start + 34



--------------------------------------------------------------------- Peter Castine email@hidden | email@hidden Next Performance http://www.castine.de/ Streichquartett (1975) http://www.bek.no/~pcastine/ Sonntag 22 Nov, 19:30 Centre Bagatelle, Zeltingerstr. 6, Berlin-Frohnau

_______________________________________________
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

_______________________________________________ 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
  • Follow-Ups:
    • Re: ExtAudioFileRead Crash
      • From: Peter Castine <email@hidden>
References: 
 >ExtAudioFileRead Crash (From: Peter Castine <email@hidden>)

  • Prev by Date: Re: AVAudioPlayer interferes Output Audiounit on Simulator ?
  • Next by Date: Re: ExtAudioFileSetProperty ClientDataFormat error on iPhone
  • Previous by thread: Re: ExtAudioFileRead Crash
  • Next by thread: Re: ExtAudioFileRead Crash
  • Index(es):
    • Date
    • Thread