From 1f20e6f31ed0a8f4755be4e188632e27076a98fb Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 10 Aug 2017 04:45:40 -0700 Subject: [PATCH] Fix maskingX variables when timeline becomes empty ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164840037 --- .../com/google/android/exoplayer2/ExoPlayerImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index c3a76cd962..f22c08f585 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -448,6 +448,12 @@ import java.util.concurrent.CopyOnWriteArraySet; case ExoPlayerImplInternal.MSG_SEEK_ACK: { if (--pendingSeekAcks == 0) { playbackInfo = (ExoPlayerImplInternal.PlaybackInfo) msg.obj; + if (timeline.isEmpty()) { + // Update the masking variables, which are used when the timeline is empty. + maskingPeriodIndex = 0; + maskingWindowIndex = 0; + maskingWindowPositionMs = 0; + } if (msg.arg1 != 0) { for (Player.EventListener listener : listeners) { listener.onPositionDiscontinuity(); @@ -472,6 +478,12 @@ import java.util.concurrent.CopyOnWriteArraySet; timeline = sourceInfo.timeline; manifest = sourceInfo.manifest; playbackInfo = sourceInfo.playbackInfo; + if (pendingSeekAcks == 0 && timeline.isEmpty()) { + // Update the masking variables, which are used when the timeline is empty. + maskingPeriodIndex = 0; + maskingWindowIndex = 0; + maskingWindowPositionMs = 0; + } for (Player.EventListener listener : listeners) { listener.onTimelineChanged(timeline, manifest); }