long ptsToTimeUs(long pts){
  if (lastPts != Long.MIN_VALUE) {
    long closestWrapCount=(lastPts + (MAX_PTS / 2)) / MAX_PTS;
    long ptsWrapBelow=pts + (MAX_PTS * (closestWrapCount - 1));
    long ptsWrapAbove=pts + (MAX_PTS * closestWrapCount);
    pts=Math.abs(ptsWrapBelow - lastPts) < Math.abs(ptsWrapAbove - lastPts) ? ptsWrapBelow : ptsWrapAbove;
  }
  long timeUs=(pts * C.MICROS_PER_SECOND) / 90000;
  if (lastPts == Long.MIN_VALUE) {
    timestampOffsetUs=firstSampleTimestamp - timeUs;
  }
  lastPts=pts;
  return timeUs + timestampOffsetUs;
}

long ptsToTimeUs ( long pts ) { if ( lastPts != Long . MIN_VALUE ) { long closestWrapCount = ( lastPts + ( MAX_PTS / 2 ) ) / MAX_PTS ; long ptsWrapBelow = pts + ( MAX_PTS * ( closestWrapCount - 1 ) ) ; long ptsWrapAbove = pts + ( MAX_PTS * closestWrapCount ) ; pts = Math . abs ( ptsWrapBelow - lastPts ) < Math . abs ( ptsWrapAbove - lastPts ) ? ptsWrapBelow : ptsWrapAbove ; } long timeUs = ( pts * C . MICROS_PER_SECOND ) / 90000 ; if ( lastPts == Long . MIN_VALUE ) { timestampOffsetUs = firstSampleTimestamp - timeUs ; } lastPts = pts ; return timeUs + timestampOffsetUs ; }
adjusts a pts value to the corresponding time in microseconds , accounting for pts wraparound .
