mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Continue playback of tracks with longer duration than the timesource.
If the timesource track renderer ends, but other track renderers haven't finished, the player would get stuck in a pending state. This change enables automatic switching to the media clock in the case that the timesource renderer has ended, which allows other renderers to continue to play.
This commit is contained in:
parent
03ef3d148f
commit
a968e5535b
@ -375,10 +375,13 @@ import java.util.List;
|
||||
}
|
||||
|
||||
private void updatePositionUs() {
|
||||
positionUs = timeSourceTrackRenderer != null &&
|
||||
enabledRenderers.contains(timeSourceTrackRenderer) ?
|
||||
timeSourceTrackRenderer.getCurrentPositionUs() :
|
||||
mediaClock.getPositionUs();
|
||||
if (timeSourceTrackRenderer != null && enabledRenderers.contains(timeSourceTrackRenderer)
|
||||
&& !timeSourceTrackRenderer.isEnded()) {
|
||||
positionUs = timeSourceTrackRenderer.getCurrentPositionUs();
|
||||
mediaClock.setPositionUs(positionUs);
|
||||
} else {
|
||||
positionUs = mediaClock.getPositionUs();
|
||||
}
|
||||
elapsedRealtimeUs = SystemClock.elapsedRealtime() * 1000;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user