Send empty timeline for empty DynamicConcatenatingMediaSource immediately.

Without child sources, the timeline can't possibly updated again within the
current looper message. Thus, we can send the empty timeline immediately.

This fixes a recently introduced flakiness in the test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187295700
This commit is contained in:
tonihei 2018-02-28 01:46:40 -08:00 committed by Andrew Lewis
parent 38914f0ba5
commit 32b4db361f

View File

@ -322,10 +322,14 @@ public final class DynamicConcatenatingMediaSource extends CompositeMediaSource<
public synchronized void prepareSourceInternal(ExoPlayer player, boolean isTopLevelSource) {
super.prepareSourceInternal(player, isTopLevelSource);
this.player = player;
if (mediaSourcesPublic.isEmpty()) {
notifyListener();
} else {
shuffleOrder = shuffleOrder.cloneAndInsert(0, mediaSourcesPublic.size());
addMediaSourcesInternal(0, mediaSourcesPublic);
scheduleListenerNotification(/* actionOnCompletion= */ null);
}
}
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator) {