Commit 819d589b by tonihei Committed by Oliver Woodman

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