Audio Latency settings not properly honored depending on video dimensions

My HDTV seems to have a 175ms delay when watching videos at 23.96 Hz. I discovered this years ago and added a latency setting in my advancedsettings.xml:

Code:
<latency>
    <refresh>
        <min>23</min>
        <max>24</max>
        <delay>175</delay>
    </refresh>
</latency>

As far as I can tell, this works perfectly for all of my movies. However, I’ve noticed that in many of my TV shows, I need to go into the audio settings, and manually set the delay to 175ms to get things to sync up. It’s not all TV shows though. I spent some time comparing multiple episodes where the audio is perfectly sync’d up using the delay setting and others where I have to manually set it, and I came to the conclusion that the only difference was in the dimensions of the video itself.

It appears that every 1280×720 video plays perfectly fine (honoring the delay). Every video that is not working has an odd size, typically 1280×718 (I saw that multiple times in non-working videos and once one that was 1280×716).

In an attempt to determine what was wrong I changed the latency in advanced settings to <delay>1175</delay>. For 1280×720 videos that were perfectly in sync the audio was now wildly off (cause it was over a second delayed). For videos that were not working properly the audio appeared to be only slightly out of sync… My guess is that it was actually delaying the audio by around 350-400ms. It was wrong, but it took my wife a couple minutes before she even noticed. Changing the delay for just that episode inside Kodi is honored perfect though (i.e. I set the delay to 175, it delays it 175).

I have plenty of widescreen movies encoded at 720p with actual resolutions like 1280×[email protected], and those work perfectly using the advancedsettings latency delay. Does something special happen with video only a couple pixels short of the full 720 height? This is easily repeatable across numerous TV episodes, but again, never any movies.

For the record, this happens with passthrough audio and decoded LPCM.