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
76a1569e79
commit
c5f9ad9f8b
@ -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.
|
// chunk even if the sample timestamps are slightly offset from the chunk start times.
|
||||||
seekInsideBuffer =
|
seekInsideBuffer =
|
||||||
primarySampleQueue.setReadPosition(seekToMediaChunk.getFirstSampleIndex(0));
|
primarySampleQueue.setReadPosition(seekToMediaChunk.getFirstSampleIndex(0));
|
||||||
decodeOnlyUntilPositionUs = Long.MIN_VALUE;
|
decodeOnlyUntilPositionUs = 0;
|
||||||
} else {
|
} else {
|
||||||
seekInsideBuffer =
|
seekInsideBuffer =
|
||||||
primarySampleQueue.advanceTo(
|
primarySampleQueue.advanceTo(
|
||||||
@ -583,7 +583,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
|||||||
if (pendingReset) {
|
if (pendingReset) {
|
||||||
boolean resetToMediaChunk = mediaChunk.startTimeUs == pendingResetPositionUs;
|
boolean resetToMediaChunk = mediaChunk.startTimeUs == pendingResetPositionUs;
|
||||||
// Only enable setting of the decode only flag if we're not resetting to a chunk boundary.
|
// 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;
|
pendingResetPositionUs = C.TIME_UNSET;
|
||||||
}
|
}
|
||||||
mediaChunk.init(mediaChunkOutput);
|
mediaChunk.init(mediaChunkOutput);
|
||||||
|
@ -544,7 +544,7 @@ public class DefaultDashChunkSource implements DashChunkSource {
|
|||||||
long endTimeUs = representationHolder.getSegmentEndTimeUs(firstSegmentNum + segmentCount - 1);
|
long endTimeUs = representationHolder.getSegmentEndTimeUs(firstSegmentNum + segmentCount - 1);
|
||||||
long periodDurationUs = representationHolder.periodDurationUs;
|
long periodDurationUs = representationHolder.periodDurationUs;
|
||||||
long clippedEndTimeUs =
|
long clippedEndTimeUs =
|
||||||
periodDurationUs != C.TIME_UNSET && periodDurationUs < endTimeUs
|
periodDurationUs != C.TIME_UNSET && periodDurationUs <= endTimeUs
|
||||||
? periodDurationUs
|
? periodDurationUs
|
||||||
: C.TIME_UNSET;
|
: C.TIME_UNSET;
|
||||||
DataSpec dataSpec = new DataSpec(segmentUri.resolveUri(baseUrl),
|
DataSpec dataSpec = new DataSpec(segmentUri.resolveUri(baseUrl),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user