jrie I would suggest optimizing the code.
if (audio_clock != (int64_t) AV_NOPTS_VALUE
&& video_clock != (int64_t) AV_NOPTS_VALUE) {
int diff;
diff = video_clock - audio_clock - VideoAudioDelay;
2 times the same code.
Or make PR, I'll look further myself.