library/core/src/main/java/com/google/android/exoplayer2/video/FixedFrameRateEstimator.java
/**
   * Called with each frame presentation timestamp.
   *
   * @param framePresentationTimeNs The frame presentation timestamp, in nanoseconds.
   */
Called with each frame presentation timestamp.
@param framePresentationTimeNs The frame presentation timestamp, in nanoseconds.
Called with each frame presentation timestamp . @param framePresentationTimeNs The frame presentation timestamp in nanoseconds .
public void onNextFrame(long framePresentationTimeNs) {
    currentMatcher.onNextFrame(framePresentationTimeNs);
    if (currentMatcher.isSynced() && !switchToCandidateMatcherWhenSynced) {
      candidateMatcherActive = false;
    } else if (lastFramePresentationTimeNs != C.TIME_UNSET) {
      if (!candidateMatcherActive || candidateMatcher.isLastFrameOutlier()) {
        candidateMatcher.reset();
        candidateMatcher.onNextFrame(lastFramePresentationTimeNs);
      }
      candidateMatcherActive = true;
      candidateMatcher.onNextFrame(framePresentationTimeNs);
    }
    if (candidateMatcherActive && candidateMatcher.isSynced()) {
      Matcher previousMatcher = currentMatcher;
      currentMatcher = candidateMatcher;
      candidateMatcher = previousMatcher;
      candidateMatcherActive = false;
      switchToCandidateMatcherWhenSynced = false;
    }
    lastFramePresentationTimeNs = framePresentationTimeNs;
  }
public void onNextFrame ( long framePresentationTimeNs ) { currentMatcher . onNextFrame ( framePresentationTimeNs ) ; if ( currentMatcher . isSynced ( ) && ! switchToCandidateMatcherWhenSynced ) { candidateMatcherActive = false ; } else if ( lastFramePresentationTimeNs != C . TIME_UNSET ) { if ( ! candidateMatcherActive || candidateMatcher . isLastFrameOutlier ( ) ) { candidateMatcher . reset ( ) ; candidateMatcher . onNextFrame ( lastFramePresentationTimeNs ) ; } candidateMatcherActive = true ; candidateMatcher . onNextFrame ( framePresentationTimeNs ) ; } if ( candidateMatcherActive && candidateMatcher . isSynced ( ) ) { Matcher previousMatcher = currentMatcher ; currentMatcher = candidateMatcher ; candidateMatcher = previousMatcher ; candidateMatcherActive = false ; switchToCandidateMatcherWhenSynced = false ; } lastFramePresentationTimeNs = framePresentationTimeNs ; }
Called with each frame presentation timestamp.
Called with each frame presentation timestamp .
// Reset the candidate with the last and current frame presentation timestamps, so that it // will try and match against the duration of the previous frame. // The candidate matcher should be promoted to be the current matcher. The current matcher // can be re-used as the next candidate matcher.