Add missing isPlaceholder forwarding in SinglePeriodAdTimeline
Also make future similar issues less likely by adding isPlaceholder to the set method of Period (in case forwarding Timeline implementations use this instead of just updating values selectively) #minor-release PiperOrigin-RevId: 372138523
This commit is contained in:
parent
4c1a294b2e
commit
61bbdb3794
@ -613,7 +613,14 @@ public abstract class Timeline implements Bundleable {
|
|||||||
int windowIndex,
|
int windowIndex,
|
||||||
long durationUs,
|
long durationUs,
|
||||||
long positionInWindowUs) {
|
long positionInWindowUs) {
|
||||||
return set(id, uid, windowIndex, durationUs, positionInWindowUs, AdPlaybackState.NONE);
|
return set(
|
||||||
|
id,
|
||||||
|
uid,
|
||||||
|
windowIndex,
|
||||||
|
durationUs,
|
||||||
|
positionInWindowUs,
|
||||||
|
AdPlaybackState.NONE,
|
||||||
|
/* isPlaceholder= */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -631,6 +638,8 @@ public abstract class Timeline implements Bundleable {
|
|||||||
* period is not within the window.
|
* period is not within the window.
|
||||||
* @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
|
* @param adPlaybackState The state of the period's ads, or {@link AdPlaybackState#NONE} if
|
||||||
* there are no ads.
|
* there are no ads.
|
||||||
|
* @param isPlaceholder Whether this period contains placeholder information because the real
|
||||||
|
* information has yet to be loaded.
|
||||||
* @return This period, for convenience.
|
* @return This period, for convenience.
|
||||||
*/
|
*/
|
||||||
public Period set(
|
public Period set(
|
||||||
@ -639,14 +648,15 @@ public abstract class Timeline implements Bundleable {
|
|||||||
int windowIndex,
|
int windowIndex,
|
||||||
long durationUs,
|
long durationUs,
|
||||||
long positionInWindowUs,
|
long positionInWindowUs,
|
||||||
AdPlaybackState adPlaybackState) {
|
AdPlaybackState adPlaybackState,
|
||||||
|
boolean isPlaceholder) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.windowIndex = windowIndex;
|
this.windowIndex = windowIndex;
|
||||||
this.durationUs = durationUs;
|
this.durationUs = durationUs;
|
||||||
this.positionInWindowUs = positionInWindowUs;
|
this.positionInWindowUs = positionInWindowUs;
|
||||||
this.adPlaybackState = adPlaybackState;
|
this.adPlaybackState = adPlaybackState;
|
||||||
this.isPlaceholder = false;
|
this.isPlaceholder = isPlaceholder;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,8 +900,8 @@ public abstract class Timeline implements Bundleable {
|
|||||||
windowIndex,
|
windowIndex,
|
||||||
durationUs,
|
durationUs,
|
||||||
positionInWindowUs,
|
positionInWindowUs,
|
||||||
adPlaybackState);
|
adPlaybackState,
|
||||||
period.isPlaceholder = isPlaceholder;
|
isPlaceholder);
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1469,8 +1479,14 @@ public abstract class Timeline implements Bundleable {
|
|||||||
@Override
|
@Override
|
||||||
public Period getPeriod(int periodIndex, Period period, boolean ignoredSetIds) {
|
public Period getPeriod(int periodIndex, Period period, boolean ignoredSetIds) {
|
||||||
Period p = periods.get(periodIndex);
|
Period p = periods.get(periodIndex);
|
||||||
period.set(p.id, p.uid, p.windowIndex, p.durationUs, p.positionInWindowUs, p.adPlaybackState);
|
period.set(
|
||||||
period.isPlaceholder = p.isPlaceholder;
|
p.id,
|
||||||
|
p.uid,
|
||||||
|
p.windowIndex,
|
||||||
|
p.durationUs,
|
||||||
|
p.positionInWindowUs,
|
||||||
|
p.adPlaybackState,
|
||||||
|
p.isPlaceholder);
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import com.google.android.exoplayer2.C;
|
|||||||
import com.google.android.exoplayer2.MediaItem;
|
import com.google.android.exoplayer2.MediaItem;
|
||||||
import com.google.android.exoplayer2.Timeline;
|
import com.google.android.exoplayer2.Timeline;
|
||||||
import com.google.android.exoplayer2.Timeline.Window;
|
import com.google.android.exoplayer2.Timeline.Window;
|
||||||
|
import com.google.android.exoplayer2.source.ads.AdPlaybackState;
|
||||||
import com.google.android.exoplayer2.upstream.Allocator;
|
import com.google.android.exoplayer2.upstream.Allocator;
|
||||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
@ -400,8 +401,9 @@ public final class MaskingMediaSource extends CompositeMediaSource<Void> {
|
|||||||
/* uid= */ setIds ? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID : null,
|
/* uid= */ setIds ? MaskingTimeline.MASKING_EXTERNAL_PERIOD_UID : null,
|
||||||
/* windowIndex= */ 0,
|
/* windowIndex= */ 0,
|
||||||
/* durationUs = */ C.TIME_UNSET,
|
/* durationUs = */ C.TIME_UNSET,
|
||||||
/* positionInWindowUs= */ 0);
|
/* positionInWindowUs= */ 0,
|
||||||
period.isPlaceholder = true;
|
/* adPlaybackState= */ AdPlaybackState.NONE,
|
||||||
|
/* isPlaceholder= */ true);
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ public final class SinglePeriodAdTimeline extends ForwardingTimeline {
|
|||||||
period.windowIndex,
|
period.windowIndex,
|
||||||
durationUs,
|
durationUs,
|
||||||
period.getPositionInWindowUs(),
|
period.getPositionInWindowUs(),
|
||||||
adPlaybackState);
|
adPlaybackState,
|
||||||
|
period.isPlaceholder);
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,8 +414,8 @@ public final class FakeTimeline extends Timeline {
|
|||||||
windowIndex,
|
windowIndex,
|
||||||
periodDurationUs,
|
periodDurationUs,
|
||||||
positionInWindowUs,
|
positionInWindowUs,
|
||||||
windowDefinition.adPlaybackState);
|
windowDefinition.adPlaybackState,
|
||||||
period.isPlaceholder = windowDefinition.isPlaceholder;
|
windowDefinition.isPlaceholder);
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user