Use only the audio timestamp frame position to detect underrun

Use the frame position to detect audio underrun instead of the whole
timestamp, since nanoTime changes during underrun conditions.

Also overhaul the wait loops using do-whiles instead, since they more
naturally express what the test is trying to accomplish.

This allows us to get further with the following test on ADT-3:
atest android.media.decoder.cts.DecoderTest#testTunneledAudioUnderrunAvc

Note: The test still fails, because av-sync is off by hundreds of
millis. I am still working with AMLogic to identify the problem.

Bug: 234327211
Test: atest android.media.decoder.cts.DecoderTest#testTunneledAudioUnderrunAvc
Change-Id: Ie4c31a23893cf41ebdeb63e1d930a5a7d53d4dbc
1 file changed