mirror of
https://github.com/androidx/media.git
synced 2025-05-15 11:39:56 +08:00
Always use same Format objects during DASH live playbacks.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117558066
This commit is contained in:
parent
4a38b2cade
commit
d870f37878
@ -443,7 +443,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
: startingNewPeriod ? representationHolder.getFirstAvailableSegmentNum()
|
: startingNewPeriod ? representationHolder.getFirstAvailableSegmentNum()
|
||||||
: queue.get(out.queueSize - 1).getNextChunkIndex();
|
: queue.get(out.queueSize - 1).getNextChunkIndex();
|
||||||
Chunk nextMediaChunk = newMediaChunk(periodHolder, representationHolder, dataSource,
|
Chunk nextMediaChunk = newMediaChunk(periodHolder, representationHolder, dataSource,
|
||||||
sampleFormat, segmentNum, evaluation.trigger);
|
selectedFormat, sampleFormat, segmentNum, evaluation.trigger);
|
||||||
lastChunkWasInitialization = false;
|
lastChunkWasInitialization = false;
|
||||||
out.chunk = nextMediaChunk;
|
out.chunk = nextMediaChunk;
|
||||||
}
|
}
|
||||||
@ -545,8 +545,8 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Chunk newMediaChunk(PeriodHolder periodHolder,
|
protected Chunk newMediaChunk(PeriodHolder periodHolder,
|
||||||
RepresentationHolder representationHolder, DataSource dataSource, Format sampleFormat,
|
RepresentationHolder representationHolder, DataSource dataSource, Format trackFormat,
|
||||||
int segmentNum, int trigger) {
|
Format sampleFormat, int segmentNum, int trigger) {
|
||||||
Representation representation = representationHolder.representation;
|
Representation representation = representationHolder.representation;
|
||||||
long startTimeUs = representationHolder.getSegmentStartTimeUs(segmentNum);
|
long startTimeUs = representationHolder.getSegmentStartTimeUs(segmentNum);
|
||||||
long endTimeUs = representationHolder.getSegmentEndTimeUs(segmentNum);
|
long endTimeUs = representationHolder.getSegmentEndTimeUs(segmentNum);
|
||||||
@ -554,16 +554,15 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
|
DataSpec dataSpec = new DataSpec(segmentUri.getUri(), segmentUri.start, segmentUri.length,
|
||||||
representation.getCacheKey());
|
representation.getCacheKey());
|
||||||
|
|
||||||
Format format = representation.format;
|
|
||||||
long sampleOffsetUs = periodHolder.startTimeUs - representation.presentationTimeOffsetUs;
|
long sampleOffsetUs = periodHolder.startTimeUs - representation.presentationTimeOffsetUs;
|
||||||
if (representationHolder.extractorWrapper == null) {
|
if (representationHolder.extractorWrapper == null) {
|
||||||
return new SingleSampleMediaChunk(dataSource, dataSpec, Chunk.TRIGGER_INITIAL, format,
|
return new SingleSampleMediaChunk(dataSource, dataSpec, Chunk.TRIGGER_INITIAL, trackFormat,
|
||||||
startTimeUs, endTimeUs, segmentNum, format, null, periodHolder.localIndex);
|
startTimeUs, endTimeUs, segmentNum, trackFormat, null, periodHolder.localIndex);
|
||||||
} else {
|
} else {
|
||||||
boolean isSampleFormatFinal = sampleFormat != null;
|
boolean isSampleFormatFinal = sampleFormat != null;
|
||||||
return new ContainerMediaChunk(dataSource, dataSpec, trigger, format, startTimeUs, endTimeUs,
|
return new ContainerMediaChunk(dataSource, dataSpec, trigger, trackFormat, startTimeUs,
|
||||||
segmentNum, sampleOffsetUs, representationHolder.extractorWrapper, sampleFormat,
|
endTimeUs, segmentNum, sampleOffsetUs, representationHolder.extractorWrapper,
|
||||||
periodHolder.drmInitData, isSampleFormatFinal, periodHolder.localIndex);
|
sampleFormat, periodHolder.drmInitData, isSampleFormatFinal, periodHolder.localIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user