Record Latency compensation on Windows and Android

We’re trying to use the lantency compensation API’s AudioIODevice::getInputLatencyInSamples() and AudioIODevice::getOutputLatencyInSamples to get the reported latency and compensate for that for recording. We use this to compensate for the device latency while recording by offsetting the recording
by the sum of the input and output latency.

This unfortunately is off hundreds of samples on both Windows and Android. As a result any recorded audio from the microphone is out of sync if you are recording to an existing track.

On Windows I can see the implementation of getInputLatencySamples calls into the WASAPI code to get the StreamLatency via IAudioClient->GetStreamLatency. That seems ok but for some reason the only way we can get the audio to line up is to apply an additional factor of about 1.5 times the computed value.

Is this a known problem? Any suggestions for doing this reliably on all platforms?