Commit 6b44c6e6 by Oliver Woodman

Fix single sample loading + seeking in HLS.

Issue #587
parent 87457d50
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment