Crash in MP3AudioFile::GetContiguousPacketCountAndSize
Crash in MP3AudioFile::GetContiguousPacketCountAndSize
- Subject: Crash in MP3AudioFile::GetContiguousPacketCountAndSize
- From: Jens Alfke <email@hidden>
- Date: Mon, 19 Sep 2005 12:07:19 -0700
I've been using the PublicUtility classes some more. They allocated
more buffer memory than I liked, especially since
CAChannelMappingPlayer has a minor mistake in that its constructor
parameter is called "ioBufferSizeBytes" but is really in units of
*frames*, not bytes. This means the buffer scheme used by afplay
really allocates 768kbytes of buffers per player, not 96k as it
appears to!
Unfortunately when I lowered the buffer-size parameter in my modified
code from 0x8000 to 0x1000, I began to get occasional but repeatable
crashes on the CABufferQueue worker thread, i.e. while reading from
the input file (always an MP3 file in my case.) Increasing the buffer
size back to the original makes the problem go away.
The crash is always in MP3AudioFile::GetContiguousPacketCountAndSize
(see full backtrace below). This method has fallen off the end of a
malloc block, into unmapped memory. The block is *not* a buffer that
I allocated, neither the output buffer nor the ExtAudioFile's I/O
buffer. I was able to use malloc_history to find that the block was
allocated by MP3AudioFile itself, inside the call to ReadPackets.
It's usually of size 0x3000.
Any clues here? It may well be a bug I've introduced, but I've been
unable to figure out what causes it, since it manifests in code and
data that I don't control.
--Jens
Thread 2 Crashed:
0 ....audio.toolbox.AudioToolbox 0x941463f0
MP3AudioFile::GetContiguousPacketCountAndSize(unsigned long, unsigned
long, unsigned long*, unsigned long*) + 120
1 ....audio.toolbox.AudioToolbox 0x94146610
MP3AudioFile::ReadPackets(unsigned char, unsigned long*,
AudioStreamPacketDescription*, long long, unsigned long*, void*) + 444
2 ....audio.toolbox.AudioToolbox 0x940e2fe8 AudioFileReadPackets +
220
3 ....audio.toolbox.AudioToolbox 0x94160e48
ExtAudioFile::ReadInputProc(OpaqueAudioConverter*, unsigned long*,
AudioBufferList*, AudioStreamPacketDescription**, void*) + 188
4 ....audio.toolbox.AudioToolbox 0x940fa980
AudioConverterChain::DirectCallInputProc(unsigned long*, unsigned
long*, AudioBufferList*, AudioStreamPacketDescription**) + 208
5 ....audio.toolbox.AudioToolbox 0x940fa7c8
CodecConverter::CallInputProc(unsigned long&) + 344
6 ....audio.toolbox.AudioToolbox 0x940fa334
CodecConverter::DecoderFillBuffer(unsigned long&, AudioBufferList&,
AudioStreamPacketDescription*) + 552
7 ....audio.toolbox.AudioToolbox 0x940e2268
BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&,
CABufferList const*&) + 172
8 ....audio.toolbox.AudioToolbox 0x940e20e8
CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned
long&, AudioStreamPacketDescription*) + 132
9 ....audio.toolbox.AudioToolbox 0x940e1e5c
BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&,
AudioStreamPacketDescription*) + 292
10 ....audio.toolbox.AudioToolbox 0x940e1fd8
AudioConverterChain::RenderOutput(CABufferList*, unsigned long,
unsigned long&, AudioStreamPacketDescription*) + 136
11 ....audio.toolbox.AudioToolbox 0x940e1e5c
BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&,
AudioStreamPacketDescription*) + 292
12 ....audio.toolbox.AudioToolbox 0x940e1ce8
AudioConverterFillComplexBuffer + 280
13 ....audio.toolbox.AudioToolbox 0x94160b88 ExtAudioFile::Read
(unsigned long&, AudioBufferList*) + 880
14 ....audio.toolbox.AudioToolbox 0x94157118 ExtAudioFileRead + 136
15 CAAudioFileStreamer.ob 0x005162f8 CAAudioFile::Read
(unsigned long&, AudioBufferList*) + 76 (CAAudioFile.h:211)
16 CAAudioFileStreamer.ob 0x00510ad8
CAAudioFileReader::ReadBuffer(CAAudioFileReader::FileReadBuffer*) +
184 (CAAudioFileStreamer.cpp:100)
17 MixerTrack.ob 0x003ca01c
CAAudioFileReader::ProcessBuffer(CABufferQueue::Buffer*) + 56
(CAAudioFileStreamer.h:102)
18 CABufferQueue.ob 0x00532534
CABufferQueue::WorkThread::Run() + 480 (CABufferQueue.cpp:90)
19 CABufferQueue.ob 0x00538e7c
CABufferQueue::WorkThread::ThreadEntry(void*) + 48 (CABufferQueue.h:142)
20 CAPThread.ob 0x00566608 CAPThread::Entry
(CAPThread*) + 176 (CAPThread.cpp:242)
21 libSystem.B.dylib 0x9002b220 _pthread_body + 96
_______________________________________________
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