• 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: Recommended way to handle suspend/resume on notebooks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recommended way to handle suspend/resume on notebooks


  • Subject: Re: Recommended way to handle suspend/resume on notebooks
  • From: Jeff Moore <email@hidden>
  • Date: Wed, 14 Oct 2009 10:15:36 -0700


On Oct 14, 2009, at 1:51 AM, Stéphane Letz wrote:


Message: 13
Date: Tue, 13 Oct 2009 11:40:26 -0700
From: Jeff Moore <email@hidden>
Subject: Re: Recommended way to handle suspend/resume on notebooks
To: CoreAudio API <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes


You should always feel free to report bugs.

It might help matters if you were able to simplify things in your set-
up to eliminate variables since it doesn't seem to affect other
applications. I'd also be very curious as to what the telemetry says
about the cause of the overloads. For example, there's a world of
difference between the overload being caused by errors from the kernel
trap and overloads caused by scheduling latency or the IOProc taking
too long.


All that said, there may be a more simple cause. One thing that caught
my eye was your description of how the system was sleeping and waking
in fits and starts. I've seen that happen in processes that have
blocked on the HAL's notification thread. One thing that changed in
SnowLeopard is that by default, the HAL will use the process's main
thread for it's notifications.

OK.

It is possible that the main thread in one of your processes has blocked and is preventing the HAL from getting notifications. If this is the problem, the fix is pretty simple. Just be sure to set the system object property, kAudioHardwarePropertyRunLoop, to NULL. This will cause the HAL to run it's own thread for handling notifications, which was the default prior to SnowLeopard.


Hum...

I tried to put :

AudioHardwareSetProperty(kAudioHardwarePropertyRunLoop, sizeof (CFRunLoopRef), NULL);

but get the "kAudioHardwareIllegalOperationError" error.

And that would be correct given the code.


I tried at different places in code (when opening the audio driver, just in the main before doing anything else...) wihout success/ (Same error code on SL and Leopard)

You are calling AudioHardwareSetProperty incorrectly. The obvious problem is that you are passing NULL for the inPropertyData when you should be passing the address of a CFRunLoopRef that is set to NULL. The other problem is that AudioHardwareSetProperty is deprecated and you should use AudioObjectSetPropertyData. The code would look like this:


CFRunLoopRef theRunLoop = NULL;
AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
OSStatus theError = AudioObjectSetPropertyData (kAudioObjectSystemObject, &theAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop);


This should probably be the first call into the HAL that the process makes. So sticking it somewhere near the beginning of main() is a good idea.

--

Jeff Moore
Core Audio
Apple



_______________________________________________
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


References: 
 >Re: Recommended way to handle suspend/resume on notebooks (From: Stéphane Letz <email@hidden>)

  • Prev by Date: Re: My Iphone audio player app gets interrupted by the iPod player - how to prevent that?
  • Next by Date: Re: My Iphone audio player app gets interrupted by the iPod
  • Previous by thread: Re: Recommended way to handle suspend/resume on notebooks
  • Next by thread: Re: Recommended way to handle suspend/resume on notebooks
  • Index(es):
    • Date
    • Thread