audio: fix latency reported when screen is on

The change for variable buffer size made that the latency
reported is always the largest value corresponding to screen
off buffer size. This causes an A/V sync problem as the audio
delay compensation is based on the latency reported by audio HAL.

Also added a maximum sleep time when waiting for buffer filling status to
go below write threshold.

Also added progressive write threshold increase when recovering from
low buffer filling status.

Change-Id: Ia29c00e7c32b66faefd2817dca2b4b54cc0d8c7b
1 file changed