mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00:00
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
This commit is contained in:
parent
a3b721e680
commit
5c52915f0c
1 changed files with 6 additions and 2 deletions
|
|
@ -62,6 +62,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
* @param format The chunk format.
|
||||
* @param startOfPlaylistInPeriodUs The position of the playlist in the period in microseconds.
|
||||
* @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 muxedCaptionFormats List of muxed caption {@link Format}s. Null if no closed caption
|
||||
* information is available in the master playlist.
|
||||
|
|
@ -137,8 +138,11 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
if (previousChunk != null) {
|
||||
id3Decoder = previousChunk.id3Decoder;
|
||||
scratchId3Data = previousChunk.scratchId3Data;
|
||||
shouldSpliceIn =
|
||||
!playlistUrl.equals(previousChunk.playlistUrl) || !previousChunk.loadCompleted;
|
||||
boolean canContinueWithoutSplice =
|
||||
(playlistUrl.equals(previousChunk.playlistUrl) && previousChunk.loadCompleted)
|
||||
|| (mediaPlaylist.hasIndependentSegments
|
||||
&& segmentStartTimeInPeriodUs >= previousChunk.endTimeUs);
|
||||
shouldSpliceIn = !canContinueWithoutSplice;
|
||||
if (shouldSpliceIn) {
|
||||
sampleQueueDiscardFromIndices = previousChunk.sampleQueueDiscardFromIndices;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue