Commit c1307239 by tonihei Committed by Oliver Woodman

Replace isTopLevelSource check by period count check in AdsMediaSource.

The top level requirement only tried to ensure that the entire timeline only
has one period. This is already asserted by ImaAdsLoader. AdsMediaSource
itself works fine as long as the wrapped timeline has one period only. This
is now asserted instead.

PiperOrigin-RevId: 227682141
parent e4ad90ef
......@@ -331,9 +331,6 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
boolean isTopLevelSource,
@Nullable TransferListener mediaTransferListener) {
super.prepareSourceInternal(player, isTopLevelSource, mediaTransferListener);
Assertions.checkArgument(
isTopLevelSource,
"AdsMediaSource must be the top-level source used to prepare the player.");
final ComponentListener componentListener = new ComponentListener();
this.componentListener = componentListener;
prepareChildSource(DUMMY_CONTENT_MEDIA_PERIOD_ID, contentMediaSource);
......@@ -444,6 +441,7 @@ public final class AdsMediaSource extends CompositeMediaSource<MediaPeriodId> {
}
private void onContentSourceInfoRefreshed(Timeline timeline, Object manifest) {
Assertions.checkArgument(timeline.getPeriodCount() == 1);
contentTimeline = timeline;
contentManifest = manifest;
maybeUpdateSourceInfo();
......
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