Commit a968e553 by Oliver Woodman

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.
parent 03ef3d14
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment