mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
parent
87457d5042
commit
6b44c6e6b1
3 changed files with 9 additions and 2 deletions
|
|
@ -138,6 +138,12 @@ public final class MediaFormat {
|
|||
maxHeight);
|
||||
}
|
||||
|
||||
public MediaFormat copyWithDurationUs(long durationUs) {
|
||||
return new MediaFormat(mimeType, maxInputSize, durationUs, width, height, rotationDegrees,
|
||||
pixelWidthHeightRatio, channelCount, sampleRate, language, initializationData, maxWidth,
|
||||
maxHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A {@link MediaFormat} representation of this format.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public final class SingleSampleSource implements SampleSource, SampleSourceReade
|
|||
// Private methods.
|
||||
|
||||
private void maybeStartLoading() {
|
||||
if (loadingFinished || state != STATE_END_OF_STREAM || loader.isLoading()) {
|
||||
if (loadingFinished || state == STATE_END_OF_STREAM || loader.isLoading()) {
|
||||
return;
|
||||
}
|
||||
if (currentLoadableException != null) {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,8 @@ public final class HlsSampleSource implements SampleSource, SampleSourceReader,
|
|||
downstreamMediaFormats = new MediaFormat[trackCount];
|
||||
mediaFormats = new MediaFormat[trackCount];
|
||||
for (int i = 0; i < trackCount; i++) {
|
||||
mediaFormats[i] = extractor.getMediaFormat(i);
|
||||
mediaFormats[i] = extractor.getMediaFormat(i).copyWithDurationUs(
|
||||
chunkSource.getDurationUs());
|
||||
}
|
||||
prepared = true;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue