Re: AudioDeviceGetCurrentTime fixed when?
Re: AudioDeviceGetCurrentTime fixed when?
- Subject: Re: AudioDeviceGetCurrentTime fixed when?
- From: Jeff Moore <email@hidden>
- Date: Fri, 28 Oct 2005 12:07:40 -0700
On Oct 27, 2005, at 8:54 PM, Steve Checkoway wrote:
I know that the bug where AudioDeviceGetCurrentTime could return a
time in the past was fixed in 10.4. Was this fix backported to any
earlier OS X versions, via quicktime updates for example?
As far as I can tell, the fix is only in Tiger.
Would this code trigger the same bug?
If you make the calls under the same circumstances you reported in
the bug, you will get the same bug. The HAL's clock code is all inter-
related.
AudioTimeStamp inTime;
AudioTimeStamp outTime;
inTime.mHostTime = AudioGetCurrentHostTime();
inTime.mFlags = kAudioTimeStampHostTimeValid;
outTime.mFlags = kAudioTimeStampSampleTimeValid;
AudioDeviceTranslateTime(mDevice, &inTime, &outTime);
return int64_t(outTime.mSampleTime);
If so, is there another way to get the current time as (should be)
returned by AudioDeviceGetCurrentTime()?
Not without the bug fix in the HAL. (The problem turned out to be a
re-entrancy issue in the HAL's clock code.)
You can wrap your calls to AudioDeviceGetCurrentTime() that checks
for the problem and just returns whatever makes sense. Although you
have to be careful about threading issues when you do that. You
either need to use a mutex to protect the last time stamp or keep the
last time stamp for each thread separately. Otherwise you will have
interference on MP machines as I found when I was fixing this bug in
the HAL =)
--
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