question: public long adjustTimestamp ( long pts ) { if ( lastPts != Long . MIN_VALUE ) { long closestWrapCount = ( lastPts + ( MAX_PTS_PLUS_ONE / 2 ) ) / MAX_PTS_PLUS_ONE ; long ptsWrapBelow = pts + ( MAX_PTS_PLUS_ONE * ( closestWrapCount - 1 ) ) ; long ptsWrapAbove = pts + ( MAX_PTS_PLUS_ONE * closestWrapCount ) ; pts = Math . abs ( ptsWrapBelow - lastPts ) < Math . abs ( ptsWrapAbove - lastPts ) ? ptsWrapBelow : ptsWrapAbove ; } long timeUs = ptsToUs ( pts ) ; if ( firstSampleTimestampUs != DO_NOT_OFFSET && lastPts == Long . MIN_VALUE ) { timestampOffsetUs = firstSampleTimestampUs - timeUs ; } lastPts = pts ; return timeUs + timestampOffsetUs ; }
target:  Scales and offsets an MPEG-2 TS presentation timestamp.