audiotrack: use AudioTrack.getLatency()
commit560221d6621c9354ae25e2a00e62f19f6a76d454
authorThomas Guillem <thomas@gllm.fr>
Mon, 23 Nov 2020 13:21:15 +0000 (23 14:21 +0100)
committerThomas Guillem <thomas@gllm.fr>
Tue, 1 Dec 2020 11:16:05 +0000 (1 12:16 +0100)
treeff8c366adeda18dbe9adb31ce7c68a1e745abdaa
parent77ddd210babf872c0285ab1f1f54169479fff529
audiotrack: use AudioTrack.getLatency()

Instead of AudioSystem.getOutputLatency().

That way, we are sure the get the latency of the current output device.

Note: both methods are hidden and should not be used in favor or
AudioTrack.getTimestamp(). Unfortunately, getTimestamp() returns a valid
timestamp too late (after few seconds) or doesn't work with some phones.
Therefore, the usage of the hidden API is still needed as a backup plan.

cf. https://github.com/google/ExoPlayer/issues/5763

The android team allow the usage of this hidden API, waiting for a new
method in next Android versions.
modules/audio_output/audiotrack.c