fix position go backward after resume

When audio played with MediaPlayer without offloaded, if we pause the player,
then call start. It may be occured that the position get from getCurrentPosition
increase first, and then decrease after a while. We found that, when call
getCurrentPosition after start() was called, mAudioSink->getPlayedOutDurationUs
retrun 0, and MediaClock was update with mAudioFirstAnchorTimeMediaUs. In this case,
audiosink has not start to play actually, but the pts will be caculated refered to
mAudioFirstAnchorTimeMediaUs. After audiosink start successfully, onNewAudioMediaTime
will be called, which will call updateAnchor to set pts. As a result, the position get
by calling getCurrentPosition get descreased, which will be observed from our UI.
Return mAudioFirstAnchorTimeMediaUs without updateAnchor before valid value obtain from
getPlayedOutDurationUs will fix this issue.

Test: NA

Change-Id: I94b644e5f31c66e1b720c7f60ed8d656842f6285
Signed-off-by: zengjing <zengjing@xiaomi.com>
1 file changed