Commit e28adb00 by tonihei Committed by Oliver Woodman

Use Handler to post action schedule finished callback.

Calling it directly might skip other callbacks. For example:
ActionSchedule.Builder().waitForTimelineChanged(...).build().
is currently immediately calling through to
callback.onActionScheduleFinished when the timeline changes.
Depending on the position of the action schedule listener in the
listener set, it may skip other listeners also
listening to timeline changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177442975
parent 7b088998
...@@ -41,6 +41,7 @@ import com.google.android.exoplayer2.testutil.Action.WaitForPositionDiscontinuit ...@@ -41,6 +41,7 @@ import com.google.android.exoplayer2.testutil.Action.WaitForPositionDiscontinuit
import com.google.android.exoplayer2.testutil.Action.WaitForSeekProcessed; import com.google.android.exoplayer2.testutil.Action.WaitForSeekProcessed;
import com.google.android.exoplayer2.testutil.Action.WaitForTimelineChanged; import com.google.android.exoplayer2.testutil.Action.WaitForTimelineChanged;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector; import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Clock; import com.google.android.exoplayer2.util.Clock;
/** /**
...@@ -487,11 +488,28 @@ public final class ActionSchedule { ...@@ -487,11 +488,28 @@ public final class ActionSchedule {
} }
@Override @Override
protected void doActionImpl(SimpleExoPlayer player, MappingTrackSelector trackSelector, protected void doActionAndScheduleNextImpl(
Surface surface) { SimpleExoPlayer player,
MappingTrackSelector trackSelector,
Surface surface,
Handler handler,
ActionNode nextAction) {
Assertions.checkArgument(nextAction == null);
if (callback != null) { if (callback != null) {
handler.post(
new Runnable() {
@Override
public void run() {
callback.onActionScheduleFinished(); callback.onActionScheduleFinished();
} }
});
}
}
@Override
protected void doActionImpl(
SimpleExoPlayer player, MappingTrackSelector trackSelector, Surface surface) {
// Not triggered.
} }
} }
......
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