Ignore empty timelines in ImaAdsLoader.

We previously only checked whether the reason for the timeline change is
RESET which indicates an empty timeline. Change this to an explicit check
for empty timelines to also ignore empty media or intermittent timeline
changes to an empty timeline which are not marked as RESET.

Issue:#5831
PiperOrigin-RevId: 248499118
This commit is contained in:
tonihei 2019-05-16 11:42:05 +01:00 committed by Oliver Woodman
parent 59b2dd2701
commit 819d589b22

View file

@ -948,8 +948,8 @@ public final class ImaAdsLoader
@Override
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
if (reason == Player.TIMELINE_CHANGE_REASON_RESET) {
// The player is being reset and this source will be released.
if (timeline.isEmpty()) {
// The player is being reset or contains no media.
return;
}
Assertions.checkArgument(timeline.getPeriodCount() == 1);