Re: ExtAudioFileWrapAudioFileID crashing in Leopard
Re: ExtAudioFileWrapAudioFileID crashing in Leopard
- Subject: Re: ExtAudioFileWrapAudioFileID crashing in Leopard
- From: "Stephen F. Booth" <email@hidden>
- Date: Mon, 29 Oct 2007 14:40:27 -0700
I think this is a bug (so yes, please file it) - but what are you
trying to achieve by wrapping this an in ext AF object and then
disposing it? (or perhaps this is just test code to expose the
problem)...
Yes, this is just code to illustrate the problem. The reason I'm
using wrapped AudioFileIDs in the first place is that in some
instances I overwrite the file's contents with a different type (ie
Apple Lossless instead of AAC), and there isn't any ExtAudioFile API
for doing this. I suppose I could delete the file in the first place,
but I have several threads writing simultaneously and I use the
existence of output files to help prevent naming collisions.
We have rewritten the MP4 parser for Leopard so it is in general
much better behaved than it was in Tiger.
I am very impressed with Leopard so far- a big thanks to the whole
Core Audio team!
Stephen
Bill
On Oct 28, 2007, at 8:42 PM, Stephen F. Booth wrote:
Hello all,
I recently upgraded to Leopard and am in the process of getting
code that functions properly on 10.4 working on 10.5. I've run
into a problem that I can't quite figure out, and before filing a
radar I wanted to see if anyone on this last had any ideas. For
some reason I am unable to create an empty AudioFileID and wrap it
using ExtAudioFile. My code looks like the following:
// Desired output
AudioStreamBasicDescription asbd;
bzero(&asbd, sizeof(AudioStreamBasicDescription));
asbd.mFormatID = kAudioFormatMPEG4AAC_HE;
asbd.mFormatFlags = kAudioFormatFlagsAreAllClear;
asbd.mSampleRate = 44100.;
asbd.mChannelsPerFrame = 2;
NSString *filename = @"/tmp/foo.m4a";
// Touch the output file
NSNumber *permissions = [NSNumber numberWithUnsignedLong:S_IRUSR
| S_IWUSR | S_IRGRP | S_IROTH];
NSDictionary *attributes = [NSDictionary
dictionaryWithObject:permissions forKey:NSFilePosixPermissions];
BOOL result = [[NSFileManager defaultManager]
createFileAtPath:filename contents:nil attributes:attributes];
NSAssert(YES == result, NSLocalizedStringFromTable(@"Unable to
create the output file.", @"Exceptions", @""));
// Open the output file
// There is no convenient ExtAudioFile API for wiping clean an
existing file, so use AudioFile
FSRef ref;
OSStatus err = FSPathMakeRef((const UInt8 *)[filename
fileSystemRepresentation], &ref, NULL);
NSAssert1(noErr == err, NSLocalizedStringFromTable(@"Unable to
locate the output file.", @"Exceptions", @""),
UTCreateStringForOSType(err));
AudioFileID audioFile;
err = AudioFileInitialize(&ref, kAudioFileM4AType, &asbd, 0,
&audioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to
%@ failed.", @"Exceptions", @""), @"AudioFileInitialize",
UTCreateStringForOSType(err));
ExtAudioFileRef extAudioFile;
err = ExtAudioFileWrapAudioFileID(audioFile, YES, &extAudioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to
%@ failed.", @"Exceptions", @""), @"ExtAudioFileWrapAudioFileID",
UTCreateStringForOSType(err));
err = ExtAudioFileDispose(extAudioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to
%@ failed.", @"Exceptions", @""), @"ExtAudioFileDispose",
UTCreateStringForOSType(err));
err = AudioFileClose(audioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to
%@ failed.", @"Exceptions", @""), @"AudioFileClose",
UTCreateStringForOSType(err));
Running the code above results in a segmentation fault:
#0 0x91ee92a8 in MP4BoxParser_Track::GetInfoFromTrackSubBoxes
#1 0x91ee99fc in MP4BoxParser_Track::GetASBD
#2 0x91ee0410 in MP4AudioFile::GetFormatListInfo
#3 0x91e9bbf4 in AudioFileObject::GetPropertyInfo
#4 0x91e9a744 in AudioFileGetPropertyInfo
#5 0x91eaed04 in ExtAudioFile::GetExistingFileInfo
#6 0x91eb04c0 in ExtAudioFile::Wrap
#7 0x91ea4e18 in ExtAudioFileWrapAudioFileID
#8 0x00002768 in -[MyDocument action:] at MyDocument.m:102
#9 0x9380835c in -[NSApplication sendAction:to:from:]
#10 0x93808290 in -[NSControl sendAction:to:]
#11 0x938077a8 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#12 0x938070e0 in -[NSButtonCell
trackMouse:inRect:ofView:untilMouseUp:]
#13 0x93806a1c in -[NSControl mouseDown:]
#14 0x93805458 in -[NSWindow sendEvent:]
#15 0x937d88f4 in -[NSApplication sendEvent:]
#16 0x93745ed8 in -[NSApplication run]
#17 0x93716930 in NSApplicationMain
#18 0x00002bd8 in main at main.m:13
Is there something wrong with my code or is this a bug in
ExtAudioFile?
Thanks,
Stephen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@apple.com
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