Re: IOAudioStream[0x280fa00]::clipIfNecessary()
Re: IOAudioStream[0x280fa00]::clipIfNecessary()
- Subject: Re: IOAudioStream[0x280fa00]::clipIfNecessary()
- From: William Stewart <email@hidden>
- Date: Mon, 24 Jan 2005 15:44:06 -0800
On 23/01/2005, at 4:10 PM, Marc Van Olmen wrote:
hi,
I have seen this error in the systemlog, after this error my
applications is doing weird and the audio starts lagging behind the
videostream. (I have written my own playback engine...) but the
application needs to run 24/7 so I need to figure out a solution for
this problem.
I went through the archives and found Nov 2004 a few e-mails around
this subject.
I have this problem with Decklink Extreme card (PCI-X) on a G5 1.8 ghz
(first generation so with PCI-X slot) using the 4.7.1 version of their
drivers.
So what can I do to prevent this problem?
If I read those e-mails of november well is that i have to increase
the buffer size of the audio output unit.
Is that correct?
I'm currently using the
BAIL_OSERROR(OpenDefaultAudioOutput(&fOutputAudioUnit));
This call is deprecated... (It opens an AU of the V1 type - see the
deprecated AUNTComponent.h
You should create a Component Description with the following fields:
type - 'auou'
subtype - 'ahal'
manu - appl
(We've constants for all of these defined n AUComponent.h - also bear
in mind that you'll have to change your callback struct to be an
AURenderCallback - the API of the callback function is slightly
different between the two)..
This doesn't change any behaviour about your real question!, but you
should at least start with this.
To open the output device and I switch it to the right device:
BAIL_OSERROR(AudioUnitSetProperty(fOutputAudioUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&aDeviceID,
sizeof(aDeviceID)));
that's correct
Should
i use kAudioUnitProperty_SetExternalBuffer
To increase the buffersize?
No...
I suspect that what is happening is that your lag between audio and
video playback is due to the fact that an audio device never runs at
the nominal sample rate, but at some minor difference (due to the
nature of crystals, etc)... So, whilst you might time and walk through
your audio samples as if the device is running at 48000Hz, it is
actually running at 47996Hz, or 48002Hz (or it jitters around abit) -
but eventually you'll be way off where you think you are, and you'll
notice a discrepancy.
The rate scalar field in an AudioTimeStamp (see
AudioDeviceGetCurrentTime) tells you the relationship between the
nominal sample rate (say 48000Hz and the "actual" sample rate at that
time of asking - of course this will change every time you ask it.
The way this is normally solved is that you use the Audio Device as the
source of time... You then use the real passage of time (count the
samples as they go past you, when they go past you as the output audio
device plays them) to detemine when to draw a video frame.
So, you have a movie running at 20 fps (and audio at 48KHz)
So a video frame needs to be drawn nominally every 50msec) - the real
question though for synch, is how many audio sample have to be played
for each video frame? (So in this case, that would be 48000 / 20 ==
2400 samples) - so actually, a video frame needs to be drawn every 2400
samples (which will rarely be exactly 50 msecs)...
Then, from there it gets complicated :-), but that's the essential
problem
Bill
I'm have a little experience yet with coreAudio so sorry for this
maybe stupid question.
greetings and thx in advance,
mvo
_______________________________________________
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
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement [GSV]
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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