Commit fed2a1a6 by aquilescanta Committed by Oliver Woodman

Fix PTS wraparound in HLS+Webvtt

Issue:#2928

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169246424
parent 5b0e6934
...@@ -141,8 +141,7 @@ import java.util.regex.Pattern; ...@@ -141,8 +141,7 @@ import java.util.regex.Pattern;
throw new ParserException("X-TIMESTAMP-MAP doesn't contain media timestamp: " + line); throw new ParserException("X-TIMESTAMP-MAP doesn't contain media timestamp: " + line);
} }
vttTimestampUs = WebvttParserUtil.parseTimestampUs(localTimestampMatcher.group(1)); vttTimestampUs = WebvttParserUtil.parseTimestampUs(localTimestampMatcher.group(1));
tsTimestampUs = TimestampAdjuster.ptsToUs( tsTimestampUs = TimestampAdjuster.ptsToUs(Long.parseLong(mediaTimestampMatcher.group(1)));
Long.parseLong(mediaTimestampMatcher.group(1)));
} }
} }
...@@ -155,8 +154,8 @@ import java.util.regex.Pattern; ...@@ -155,8 +154,8 @@ import java.util.regex.Pattern;
} }
long firstCueTimeUs = WebvttParserUtil.parseTimestampUs(cueHeaderMatcher.group(1)); long firstCueTimeUs = WebvttParserUtil.parseTimestampUs(cueHeaderMatcher.group(1));
long sampleTimeUs = timestampAdjuster.adjustSampleTimestamp( long sampleTimeUs = timestampAdjuster.adjustTsTimestamp(
firstCueTimeUs + tsTimestampUs - vttTimestampUs); TimestampAdjuster.usToPts(firstCueTimeUs + tsTimestampUs - vttTimestampUs));
long subsampleOffsetUs = sampleTimeUs - firstCueTimeUs; long subsampleOffsetUs = sampleTimeUs - firstCueTimeUs;
// Output the track. // Output the track.
TrackOutput trackOutput = buildTrackOutput(subsampleOffsetUs); TrackOutput trackOutput = buildTrackOutput(subsampleOffsetUs);
......
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