Commit e5d14667 by bachinger Committed by Ian Baker

Avoid rebuffering at the end of SSAI post-rolls

When the start position of a MediaPeriodInfo is equal or higher than the duration,
we set the start position to `duration - 1` to end on the last frame. With server
side inserted ad streams, this has the effect that we actually need to seek back to
the last content frame after a post-roll.

This is desirable when actually ending on that frame but produces a BUFFERING event
when transitioning from an SSAI stream with a post-roll to the next media item in
the playlist. This change sets the start position to the duration when we are
clipping the last content period of an SSAI stream that is played in a playlist.

PiperOrigin-RevId: 433445680
parent 140be836
......@@ -925,7 +925,8 @@ import com.google.common.collect.ImmutableList;
: endPositionUs;
if (durationUs != C.TIME_UNSET && startPositionUs >= durationUs) {
// Ensure start position doesn't exceed duration.
startPositionUs = max(0, durationUs - 1);
boolean endAtLastFrame = isLastInTimeline || !clipPeriodAtContentDuration;
startPositionUs = max(0, durationUs - (endAtLastFrame ? 1 : 0));
}
return new MediaPeriodInfo(
id,
......
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