Re: Audio Video sync with Core Audio Queue Services
Re: Audio Video sync with Core Audio Queue Services
- Subject: Re: Audio Video sync with Core Audio Queue Services
- From: Stephen Thomas <email@hidden>
- Date: Mon, 2 Nov 2009 10:40:18 +0530
Hi William,
Thanks for the reply.
I have tried getting audio timeline and deriving timing info from get time api of AQ.
Logic is as follows:
1) I obtain the audio buffer of duration 32 ms. Each buffer will have a time stamp associated with it.
2) Whenever AQ calls callback asking for more buffer, I get the time stamp of processed audio buffer.
It is referred as base time stamp. Now I need to get the time stamp of the audio buffer which is getting played.
TimeStamp = BaseTimeStamp - (SamplesSent - SamplesPlayed)/SamplingRate;
Code:
#define BUFFER_DURATION 32
AudioTimeStamp currentTime = {0};
AudioQueueGetCurrentTime (m_AudioQueueHandle, m_AudioQueueTimeLine, ¤tTime, &discontinuity);
Float64 offset = (Float64)( ((Float64)m_udwPacketsSent * BUFFER_DURATION * (m_StreamFormat.mSampleRate / 1000)) - currentTime.mSampleTime)/m_StreamFormat.mSampleRate;
timeStamp.m_Timestamp = m_BaseTimeStamp.m_Timestamp - offset;
Problems encountered:
1) When I used the call "AudioQueueGetCurrentTime" in the AQ's callback. Audio became jerky. It looks like AudioQueueGetCurrentTime is costly call. So I had to place the call in separate timer call.
2) The time stamp obtained does not seems to be of the buffer getting played. Still AV is out of sink in one of the MacBookPro.
In the systems where AV sink is fine, the offset is "0.009", whereas in defective system it is "0.1".
Please help me analyzing what is going wrong here.
Regards
Stephen
_______________________________________________
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