- Posts: 3
- Joined: Wed Apr 15, 2015 4:52 pm
AudioOutput seems to buffer 1 sec ahead -> causing a 1 sec delay of the audio-output
I am using ScheduleVideoFrame() for many years now to successfully display video on a Decklink-SDI. Now I want to add Audio on top of that, using ScheduleAudioSamples(). While that works, the audio is always delayed by roughly one second.
I am feeding in Audio at 48000 Hz at 16 bits. Using GetBufferedAudioSampleFrameCount() I noticed that right after starting audio/video playback the audio buffer gradually gets filled up to 53760 samples, which is exactly the 48000 samples for 1 sec, PLUS the 4 video-frames of pre-roll I am performing, at 1920 samples per frame.
Here's the log:
As you can see, roughly 1 second after the call to EndAudioPreroll() the audio sample buffer has grown to 53760 (according to GetBufferedAudioSampleFrameCount()). The number of buffered video-frames is still at 4.
I wonder what makes the audio-buffer queue 1 sec of audio? My code is based on SignalGenerator - the only sample I could find in the SDK dealing with audio-output.
Here's what my code basically looks like:
Any help is highly appreciated! Thanks a lot!
I am using ScheduleVideoFrame() for many years now to successfully display video on a Decklink-SDI. Now I want to add Audio on top of that, using ScheduleAudioSamples(). While that works, the audio is always delayed by roughly one second.
I am feeding in Audio at 48000 Hz at 16 bits. Using GetBufferedAudioSampleFrameCount() I noticed that right after starting audio/video playback the audio buffer gradually gets filled up to 53760 samples, which is exactly the 48000 samples for 1 sec, PLUS the 4 video-frames of pre-roll I am performing, at 1920 samples per frame.
Here's the log:
- Code: Select all
[2015-04-15 18:28:41,674 +0200] starting pre-roll...
[2015-04-15 18:28:41,675 +0200] audio out: 0 (A: 0 samples, V: 0 frames)
[2015-04-15 18:28:41,676 +0200] audio out: 1920 (A: 1920 samples, V: 2 frames)
[2015-04-15 18:28:41,677 +0200] audio out: 3840 (A: 3840 samples, V: 3 frames)
[2015-04-15 18:28:41,678 +0200] audio out: 5760 (A: 5760 samples, V: 4 frames)
[2015-04-15 18:28:41,677 +0200] ended pre-roll
[2015-04-15 18:28:41,678 +0200] started audio/video decklink output
..
[2015-04-15 18:28:42,691 +0200] audio out: 99840 (A: 53760 samples, V: 4 frames)
As you can see, roughly 1 second after the call to EndAudioPreroll() the audio sample buffer has grown to 53760 (according to GetBufferedAudioSampleFrameCount()). The number of buffered video-frames is still at 4.
I wonder what makes the audio-buffer queue 1 sec of audio? My code is based on SignalGenerator - the only sample I could find in the SDK dealing with audio-output.
Here's what my code basically looks like:
- Code: Select all
BeginAudioPreroll()
4 x ScheduleVideoFrame()
EndAudioPreroll()
StartScheduledPlayback(0, 100, 1.0);
Any help is highly appreciated! Thanks a lot!