Re: crashing in calls to AudioConverter on 10.3.9
Re: crashing in calls to AudioConverter on 10.3.9
- Subject: Re: crashing in calls to AudioConverter on 10.3.9
- From: William Stewart <email@hidden>
- Date: Wed, 29 Mar 2006 17:00:17 -0800
There is no file format that takes non-interleaved audio.
ExtAudioFile is based on AudioFile - it puts an AudioConverter
between the file and the client. So, the client is free to specify an
appropriate format to convert the file data too for its consumer.
However, underlying this it access the audio file object through the
AudioFile API.
Bill
On 29/03/2006, at 4:08 PM, Christopher Ashworth wrote:
On Mar 29, 2006, at 3:25 PM, Doug Wyatt wrote:
I'm sorry, I was thinking of ExtAudioFileRead, which takes an
AudioBufferList, but of course you're using AudioFileRead which
only takes a buffer pointer.
Ah, okay. Thanks for the clarification. As an aside, I take it
this implies that on systems prior to 10.4, CoreAudio only provides
support for reading audio files that are mono or interleaved, and
that someone wanting to read a non-interleaved, multi-channel
format would have to roll their own version of ExtAudioFileRead?
If so, does anyone on the list have a sense of how many sound files
"in the wild" are of the sort that would require an
ExtAudioFileRead-based approach?
At any rate, returning to the mysterious crashes...
In that case I'd suggest making the simplest possible input proc
for this AudioConverter -- return valid data in chunks the same
size as if you were reading from the file, but don't actually read
from the file or do anything else. Does it still crash?
Yes.
I stuck with the files mentioned in my earlier crash report, namely
the one for which I am using a converter of this type:
AudioConverter: @5348320
AudioConverter PCMConverter 0x3D4FB0
Input: 1 ch, 11025 Hz, 'lpcm' (0x00000008) 8-bit unsigned
integer
Output: 1 ch, 11025 Hz, 'lpcm' (0x0000000B) 32-bit big-
endian float
AudioConverter SampleRateConverter 0x5349C20
Input: 1 ch, 11025 Hz, 'lpcm' (0x0000000B) 32-bit big-
endian float
Output: 1 ch, 44100 Hz, 'lpcm' (0x0000000B) 32-bit big-
endian float
I then modified my converter input proc to be very simple indeed,
as follows:
static OSStatus _converterInputProc( AudioConverterRef
inAudioConverter,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void * userData )
{
// <...snip extraction of userData...>
// Confirm that ioNumberDataPackets worth of information will fit.
if (*ioNumberDataPackets > bufferSizeInFilePackets)
*ioNumberDataPackets = bufferSizeInFilePackets;
// If there are not enough packets left in the file, then read
what's left.
if (*packetOffset + *ioNumberDataPackets > fileTotalPacketCount)
*ioNumberDataPackets = fileTotalPacketCount - *packetOffset;
// Clear conversion buffer.
memset(conversionBuffer, 0, fileMaxPacketSize *
bufferSizeInFilePackets);
// Computer byte count and update packet offset.
UInt32 conversionBufferByteCount = 0;
conversionBufferByteCount = fileMaxPacketSize * *ioNumberDataPackets;
*packetOffset += *ioNumberDataPackets;
ioData->mNumberBuffers = 1;
ioData->mBuffers[0].mData = conversionBuffer;
ioData->mBuffers[0].mDataByteSize = conversionBufferByteCount;
ioData->mBuffers[0].mNumberChannels = 1;
return noErr;
}
As before, this version of the application runs (albeit silently)
without incident on 10.4.5, but crashes when multiple (silent)
sounds are playing on 10.3.9.
Here's the tail end of the relevant tracebacks (the other threads
are doing little of interest, as in the last full log I posted):
Thread 2 Crashed:
0 <<00000000>> 0xffff8a60 __memcpy + 0x2c0
1 ....audio.toolbox.AudioToolbox 0x93c0516c
AudioConverterChain::FillBufferFromInputProc(unsigned long*,
unsigned long*, CABufferList*, AudioStreamPacketDescription**) + 0x13c
2 ....audio.toolbox.AudioToolbox 0x93c0147c
BufferedAudioConverter::GetInputBytes(unsigned long, unsigned
long&, CABufferList const*&) + 0xd8
3 ....audio.toolbox.AudioToolbox 0x93c016a8
CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned
long&, AudioStreamPacketDescription*) + 0x58
4 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
5 ....audio.toolbox.AudioToolbox 0x93c01450
BufferedAudioConverter::GetInputBytes(unsigned long, unsigned
long&, CABufferList const*&) + 0xac
6 ....audio.toolbox.AudioToolbox 0x93c016a8
CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned
long&, AudioStreamPacketDescription*) + 0x58
7 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
8 ....audio.toolbox.AudioToolbox 0x93c04fac
AudioConverterChain::RenderOutput(CABufferList*, unsigned long,
unsigned long&, AudioStreamPacketDescription*) + 0x58
9 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
10 ....audio.toolbox.AudioToolbox 0x93c01610
AudioConverterFillComplexBuffer + 0x118
[...snip...]
Also:
Thread 2 Crashed:
0 <<00000000>> 0xffff8c6c __memcpy + 0x4cc
1 ....audio.toolbox.AudioToolbox 0x93c04938 Resampler2::Convert
(float*, float*, unsigned long, int) + 0x3184
2 ....audio.toolbox.AudioToolbox 0x93c062f0 Resampler2::Process2
(float*, float*, unsigned long, int) + 0xa8
3 ....audio.toolbox.AudioToolbox 0x93c05ea8
Resampler2Wrapper::RenderOutput(CABufferList*, unsigned long,
unsigned long&) + 0x2b0
4 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
5 ....audio.toolbox.AudioToolbox 0x93c04fac
AudioConverterChain::RenderOutput(CABufferList*, unsigned long,
unsigned long&, AudioStreamPacketDescription*) + 0x58
6 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
7 ....audio.toolbox.AudioToolbox 0x93c01610
AudioConverterFillComplexBuffer + 0x118
[...snip...]
There was even one run that crashed in my callback function at the
line:
if (*ioNumberDataPackets > bufferSizeInFilePackets)
due to:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x02808000
Here's that traceback:
Thread 4 Crashed:
0 <<00000000>> 0xffff8660 __bzero + 0x60
1 com.figure53.qlab.SoundCue 0x00bd5790 _converterInputProc
+ 0x104 (Sound.m:937)
2 ....audio.toolbox.AudioToolbox 0x93c05438
AudioConverterChain::CallInputProc(unsigned long) + 0x138
3 ....audio.toolbox.AudioToolbox 0x93c051d8
AudioConverterChain::FillBufferFromInputProc(unsigned long*,
unsigned long*, CABufferList*, AudioStreamPacketDescription**) + 0x1a8
4 ....audio.toolbox.AudioToolbox 0x93c0147c
BufferedAudioConverter::GetInputBytes(unsigned long, unsigned
long&, CABufferList const*&) + 0xd8
5 ....audio.toolbox.AudioToolbox 0x93c016a8
CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned
long&, AudioStreamPacketDescription*) + 0x58
6 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
7 ....audio.toolbox.AudioToolbox 0x93c01450
BufferedAudioConverter::GetInputBytes(unsigned long, unsigned
long&, CABufferList const*&) + 0xac
8 ....audio.toolbox.AudioToolbox 0x93c016a8
CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned
long&, AudioStreamPacketDescription*) + 0x58
9 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
10 ....audio.toolbox.AudioToolbox 0x93c04fac
AudioConverterChain::RenderOutput(CABufferList*, unsigned long,
unsigned long&, AudioStreamPacketDescription*) + 0x58
11 ....audio.toolbox.AudioToolbox 0x93c012b0
BufferedAudioConverter::FillBuffer(unsigned long&,
AudioBufferList&, AudioStreamPacketDescription*) + 0x124
12 ....audio.toolbox.AudioToolbox 0x93c01610
AudioConverterFillComplexBuffer + 0x118
[...snip...]
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
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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