Skip to content

Commit

Permalink
Fix PTS wraparound in HLS+Webvtt
Browse files Browse the repository at this point in the history
Issue:#2928

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169246424
  • Loading branch information
AquilesCanta authored and ojw28 committed Sep 20, 2017
1 parent 06bba08 commit ca4d482
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ private void processSample() throws ParserException {
throw new ParserException("X-TIMESTAMP-MAP doesn't contain media timestamp: " + line);
}
vttTimestampUs = WebvttParserUtil.parseTimestampUs(localTimestampMatcher.group(1));
tsTimestampUs = TimestampAdjuster.ptsToUs(
Long.parseLong(mediaTimestampMatcher.group(1)));
tsTimestampUs = TimestampAdjuster.ptsToUs(Long.parseLong(mediaTimestampMatcher.group(1)));
}
}

Expand All @@ -155,8 +154,8 @@ private void processSample() throws ParserException {
}

long firstCueTimeUs = WebvttParserUtil.parseTimestampUs(cueHeaderMatcher.group(1));
long sampleTimeUs = timestampAdjuster.adjustSampleTimestamp(
firstCueTimeUs + tsTimestampUs - vttTimestampUs);
long sampleTimeUs = timestampAdjuster.adjustTsTimestamp(
TimestampAdjuster.usToPts(firstCueTimeUs + tsTimestampUs - vttTimestampUs));
long subsampleOffsetUs = sampleTimeUs - firstCueTimeUs;
// Output the track.
TrackOutput trackOutput = buildTrackOutput(subsampleOffsetUs);
Expand Down

0 comments on commit ca4d482

Please sign in to comment.