Audio is delayed by ~40ms (1080i5000).

Playing the same Vistek Valid MXF file (1080i5000) created and validated on external equipment through FFMPEG producer to Decklink consumer with different channel configurations:
Channel set to 1080i5000 Audio Delay 26ms
Channel set to 720p5000 Audio Delay 14ms
Channel set to PAL Audio Delay 4ms
Is ffmpeg_consumer out of sync as well?
Let me check... May take a while. I am quiet busy at the moment.
@premultiply nvm, @5opr4ni's check answers my question
@ronag Not for shure. Exactly one frame may be another reason than the different offsets seen on my measurements on decklink output.
can you provide your test file?
Yep. But it's quite huge and you may need a valid reader device for it.
96 hours later. ;)

So it's roughly 60 ms off in 50i? What about 50p?
So I did some tests again. The audio offset is not fix (file to decklink). It changes in range from 0 to 40 ms when restarting the server and/or changing the output mode but it seems to be constant over time.
40ms, se my image earlier in the thread so you can compare with the original file.
Recording file by ffmpeg_consumer and playing again through server to decklink_consumer adds no additional delay so ffmpeg_consumer seems to be fine.
ok, so it's a decklink frame scheduling issue. Could be either Caspar or Decklink drivers or both.
I am wondering why there is no "connection" to the hardware reference clock of the decklink board visible to me from code. For me it looks like server feeds frames by "system time" (or HPET etc.) to decklink board. So decklink boards will drop or duplicate frames as needed to match their own free running or genlocked clock. Decklink is not the clock master for channel. This would explain why there is random timing. Or am I wrong?
Or am I wrong?
You are wrong :). The decklink "consumer" api has a callback it calls based on it's internal clock.
https://github.com/CasparCG/server/blob/8dcbc80c617211eda521a80ec38d3215eb7d2dd7/src/modules/decklink/consumer/decklink_consumer.cpp#L726
Maybe this is the reason for the main 1 Frame Audio Offset.
Has anybody checked if this is really true?:
Buffering 3 Frames of Video and 4 Frames auf Audio??? Sounds really strange to me.
What happens if they are set equal? Can someone build it with equal buffersizes for me?
yes... that has occurred to me as well... I think helge wanted to lower the latency by doing that... but yea that means the audio is off sync.
@premultiply could you try with master now?
The 1 frame offset ist fixed for normal and low delay mode now.

Good job guys. Brilliant.
System delay (decklink_producer to decklink_consumer, genlocked) is 8 frames in low delay mode now and 9 frames in normal mode now.
Thank you for that valuable information. And is it consistent?
Genlocked yes. Haven't measured it without genlocking the decklink card... Let me check...
@premultiply thanks for the help!
Most helpful comment
Genlocked yes. Haven't measured it without genlocking the decklink card... Let me check...