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