I've got a kext based on Apple's AudioReflectorDriver sample code (it intercepts audio output and makes a copy).
On <= 10.6, when you call proc_selfpid() inside the IOAudioEngine subclass, it reports the PID of the process that generates the audio. On 10.7, it always reports coreaudio_d as the process.
What changed? Does anyone know where Apple has documented this change? Is there any way to get the originating process ID in Lion?
Update... an Apple DTS engineer has informed me that:
The Audio HAL was completely rewritten in Lion and this change was almost certainly a side effect of that effort. I don't believe that this was a deliberate change, but was instead driven by larger architectural changes in CoreAudio. Strictly speaking, I don't believe that proc_selfpid was ever documented to return something useful in the audio context, so it's entirely possible that this information is simply not available anymore.
[....]
The problem is not that the kernel is returing the wrong pid, but is instead that CoreAudio's architecture has changed such that the audio is coming from a different process.
Still waiting to hear back from him if there's any w开发者_JAVA百科ay to get this info in 10.7.
My suspicion now is that it wasn't documented because the rewrite didn't alter the API.
精彩评论