Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit db13135c authored by zengjing's avatar zengjing
Browse files

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: default avatarzengjing <zengjing@xiaomi.com>
parent 05fa2454
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment