Commit 9bcc00f3 by Oliver Woodman

Fix reported buffered position for HLS across format switches.

parent a7ba393d
......@@ -353,6 +353,12 @@ public final class HlsSampleSource implements SampleSource, SampleSourceReader,
return TrackRenderer.END_OF_TRACK_US;
} else {
long largestParsedTimestampUs = extractors.getLast().getLargestParsedTimestampUs();
if (extractors.size() > 1) {
// When adapting from one format to the next, the penultimate extractor may have the largest
// parsed timestamp (e.g. if the last extractor hasn't parsed any timestamps yet).
largestParsedTimestampUs = Math.max(largestParsedTimestampUs,
extractors.get(extractors.size() - 2).getLargestParsedTimestampUs());
}
return largestParsedTimestampUs == Long.MIN_VALUE ? downstreamPositionUs
: largestParsedTimestampUs;
}
......
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