Re: Source debugging into coreaudio
Re: Source debugging into coreaudio
- Subject: Re: Source debugging into coreaudio
- From: Chuck Carlson <email@hidden>
- Date: Thu, 29 Oct 2009 10:43:33 -0700
#0 0x91f1991b in objc_msgSend
#1 0xa09c5810 in __block_descriptor_tmp_2.172
#2 0x91e7f5c7 in IOA_HWDevice::IsConstantRateClock
#3 0x91e7f523 in IOA_HWDevice::IsConstantRateClock
#4 0x91e7f174 in IOA_HWDevice::Initialize
#5 0x91e7e6b2 in IOA_HWDeviceManager::IOServiceMatchingHandler
#6 0x91e7e5fb in IOA_HWDeviceManager::Initialize
#7 0x91e7baab in HP_HardwarePlugIn_InitializeWithObjectID
#8 0x91e7ba3a in HALPlugIn::Initialize
#9 0x91e7abca in HALPlugInManagement::CreateHALPlugIn
#10 0x91e794bf in HALPlugInManagement::Initialize
#11 0x91e79325 in HALSystem::InitializeDevices
#12 0x91e74ddf in HALSystem::CheckOutInstance
#13 0x91ea1526 in AudioHardwareGetProperty
#14 0x00001c05 in main at simpleserver.c:24
On Wed, Oct 28, 2009 at 11:36 AM, Jeff Moore
<email@hidden> wrote:
On Oct 28, 2009, at 10:15 AM, Chuck Carlson wrote:
Thanks Jeff, but I do have GuadMalloc enabled and am not getting any notification of problems on the first run.
GuardMalloc "notifies" by causing a crash when it detects a bad memory access =)
I have a feeling the problem is with the USBAudio driver I am using. I do have the source and can build with firelog options, but am looking for some more clues.
Except for some very rare situations, audio drivers in the kernel don't corrupt memory in a user process. In fact of all the times I have seen crashes like yours (like I said, it seems to come up more often than you'd think), there hasn't been a single instance where the driver was at fault.
I'm not saying that you are wrong in suspecting the driver. Drivers do a lot of unexpected things. But, it makes more sense in this case to look for user-land causes of this problem first.
Jeff, I've simplified the offending program to the point where I cannot think of anything that I'm doing that could corrupt memory. See below.
If I do the first run on the built in device, then do the second run on the usb audio device, the failure still happens on the second run.
I've examined registers and memory from the dissasembled code and can find only a small difference in one of the args and not some kind of memory blasting.
Here's the offending call history:
#0 0x91f1991b in objc_msgSend
#1 0xa09c5810 in __block_descriptor_tmp_2.172
#2 0x91e7f5c7 in IOA_HWDevice::IsConstantRateClock
#3 0x91e7f523 in IOA_HWDevice::IsConstantRateClock
#4 0x91e7f174 in IOA_HWDevice::Initialize
#5 0x91e7e6b2 in IOA_HWDeviceManager::IOServiceMatchingHandler
#6 0x91e7e5fb in IOA_HWDeviceManager::Initialize
#7 0x91e7baab in HP_HardwarePlugIn_InitializeWithObjectID
#8 0x91e7ba3a in HALPlugIn::Initialize
#9 0x91e7abca in HALPlugInManagement::CreateHALPlugIn
#10 0x91e794bf in HALPlugInManagement::Initialize
#11 0x91e79325 in HALSystem::InitializeDevices
#12 0x91e74ddf in HALSystem::CheckOutInstance
#13 0x91ea1526 in AudioHardwareGetProperty
#14 0x00001c05 in main at simpleserver.c:24
Here's the code:
#include <stdio.h>
#include <CoreAudio/CoreAudio.h>
OSStatus appIOProc (AudioDeviceID inDevice, const AudioTimeStamp* inNow, const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime,
void* defptr)
{
return kAudioHardwareNoError;
}
int main(int argc,char *argv[]) {
UInt32 frameSize = 64;
UInt32 propertySize;
OSStatus err = noErr;
AudioDeviceID outputDeviceID;
AudioDeviceIOProcID procID;
propertySize = sizeof(outputDeviceID);
// yes I know AudioDeviceGet/SetProperty is deprecated but why not suggest replacement in AudioHardware.h
err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice,
&propertySize, &outputDeviceID);
if (err) {
fprintf(stderr, "AudioHardwareGetProperty returned %ld\n", err);
return 1;
}
if (outputDeviceID == kAudioDeviceUnknown) {
fprintf(stderr, "outputDeviceID is kAudioDeviceUnknown\n");
return 1;
}
propertySize = sizeof(frameSize);
err = AudioDeviceSetProperty( outputDeviceID, NULL, 0, true,kAudioDevicePropertyBufferFrameSize, propertySize, &frameSize);
if (err) {
return 1;
}
err = AudioDeviceCreateIOProcID(outputDeviceID, appIOProc,NULL,&procID);
if (err != kAudioHardwareNoError)
return 1;
err = AudioDeviceStart(outputDeviceID, procID);
sleep(5);
AudioDeviceStop(outputDeviceID,procID);
return 0;
}
_______________________________________________
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