mirror of
https://github.com/samsonjs/media.git
synced 2026-03-31 10:25:48 +00:00
Minor fixes for period clipping
- Always clip to period duration for the last chunk. We previously did this only when the last chunk explicitly exceeded the period end time. We now also do it when the chunk claims to end at the period boundary, but still contains samples that exceed it. - If pendingResetPositionUs == chunk.startTimeUs == 0 but the chunk still contains samples with negative timestamps, we now clip them by setting the decode only flag. Previously we only clipped such samples if the first chunk explicitly preceeded the start of the period. Issue: #4899 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=215763467
This commit is contained in:
parent
a35bf5151d
commit
4d8b6803af
2 changed files with 3 additions and 3 deletions
|
|
@ -308,7 +308,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
|||
// chunk even if the sample timestamps are slightly offset from the chunk start times.
|
||||
seekInsideBuffer =
|
||||
primarySampleQueue.setReadPosition(seekToMediaChunk.getFirstSampleIndex(0));
|
||||
decodeOnlyUntilPositionUs = Long.MIN_VALUE;
|
||||
decodeOnlyUntilPositionUs = 0;
|
||||
} else {
|
||||
seekInsideBuffer =
|
||||
primarySampleQueue.advanceTo(
|
||||
|
|
@ -583,7 +583,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
|||
if (pendingReset) {
|
||||
boolean resetToMediaChunk = mediaChunk.startTimeUs == pendingResetPositionUs;
|
||||
// Only enable setting of the decode only flag if we're not resetting to a chunk boundary.
|
||||
decodeOnlyUntilPositionUs = resetToMediaChunk ? Long.MIN_VALUE : pendingResetPositionUs;
|
||||
decodeOnlyUntilPositionUs = resetToMediaChunk ? 0 : pendingResetPositionUs;
|
||||
pendingResetPositionUs = C.TIME_UNSET;
|
||||
}
|
||||
mediaChunk.init(mediaChunkOutput);
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||
long endTimeUs = representationHolder.getSegmentEndTimeUs(firstSegmentNum + segmentCount - 1);
|
||||
long periodDurationUs = representationHolder.periodDurationUs;
|
||||
long clippedEndTimeUs =
|
||||
periodDurationUs != C.TIME_UNSET && periodDurationUs < endTimeUs
|
||||
periodDurationUs != C.TIME_UNSET && periodDurationUs <= endTimeUs
|
||||
? periodDurationUs
|
||||
: C.TIME_UNSET;
|
||||
DataSpec dataSpec = new DataSpec(segmentUri.resolveUri(baseUrl),
|
||||
|
|
|
|||
Loading…
Reference in a new issue