Commit 5c52915f by tonihei Committed by Oliver Woodman

Don't splice in if segments don't overlap and segments are independent.

If the sample times don't overlap and are independent, splicing makes no
difference because all samples (starting from the first one, which must be
a keyframe) will be appended to the end of the queue anyway.

PiperOrigin-RevId: 313594372
parent a3b721e6
...@@ -62,6 +62,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -62,6 +62,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* @param format The chunk format. * @param format The chunk format.
* @param startOfPlaylistInPeriodUs The position of the playlist in the period in microseconds. * @param startOfPlaylistInPeriodUs The position of the playlist in the period in microseconds.
* @param mediaPlaylist The media playlist from which this chunk was obtained. * @param mediaPlaylist The media playlist from which this chunk was obtained.
* @param segmentIndexInPlaylist The index of the segment in the media playlist.
* @param playlistUrl The url of the playlist from which this chunk was obtained. * @param playlistUrl The url of the playlist from which this chunk was obtained.
* @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption * @param muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption
* information is available in the master playlist. * information is available in the master playlist.
...@@ -137,8 +138,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull; ...@@ -137,8 +138,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
if (previousChunk != null) { if (previousChunk != null) {
id3Decoder = previousChunk.id3Decoder; id3Decoder = previousChunk.id3Decoder;
scratchId3Data = previousChunk.scratchId3Data; scratchId3Data = previousChunk.scratchId3Data;
shouldSpliceIn = boolean canContinueWithoutSplice =
!playlistUrl.equals(previousChunk.playlistUrl) || !previousChunk.loadCompleted; (playlistUrl.equals(previousChunk.playlistUrl) && previousChunk.loadCompleted)
|| (mediaPlaylist.hasIndependentSegments
&& segmentStartTimeInPeriodUs >= previousChunk.endTimeUs);
shouldSpliceIn = !canContinueWithoutSplice;
if (shouldSpliceIn) { if (shouldSpliceIn) {
sampleQueueDiscardFromIndices = previousChunk.sampleQueueDiscardFromIndices; sampleQueueDiscardFromIndices = previousChunk.sampleQueueDiscardFromIndices;
} }
......
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