coreaudio: disable resampling when latency is too high
commitf18fef325af25113875b09c8f727017febc6198a
authorThomas Guillem <thomas@gllm.fr>
Mon, 12 Mar 2018 15:06:48 +0000 (12 16:06 +0100)
committerThomas Guillem <thomas@gllm.fr>
Mon, 12 Mar 2018 16:57:20 +0000 (12 17:57 +0100)
treef32ca2949fc1f61f49e0b52d037711b0eda1fc82
parentbcf9c70debdf32e074ce285476d0a3096c653e59
coreaudio: disable resampling when latency is too high

On iOS, the render callback is called by default with 1024 frames, and 4096
when the screen is OFF. 4096 frames @ 44.1Hhz is around 88ms, which is higher
than AOUT_MAX_PTS_DELAY (60ms). This caused the resampler to be started/stopped
very often when the screen was OFF due to the imprecision of 88ms from the
TimeGet callback.

To fix this issue, this commit disable the TimeGet callback when the latency is
too high.

This will also save some CPU time by disabling any synchronisation when the
screen is OFF. From my tests, high latency is only triggered by switching OFF
the display.

Fixes #18939
modules/audio_output/auhal.c
modules/audio_output/coreaudio_common.c
modules/audio_output/coreaudio_common.h