library/core/src/main/java/com/google/android/exoplayer2/extractor/ts/AdtsReader.java
private void checkAdtsHeader(ParsableByteArray buffer) {
    if (buffer.bytesLeft() == 0) {
      // Not enough data to check yet, defer this check.
      return;
    }
    // Peek the next byte of buffer into scratch array.
    adtsScratch.data[0] = buffer.data[buffer.getPosition()];

    adtsScratch.setPosition(2);
    int currentFrameSampleRateIndex = adtsScratch.readBits(4);
    if (firstFrameSampleRateIndex != C.INDEX_UNSET
        && currentFrameSampleRateIndex != firstFrameSampleRateIndex) {
      // Invalid header.
      resetSync();
      return;
    }

    if (!foundFirstFrame) {
      foundFirstFrame = true;
      firstFrameVersion = currentFrameVersion;
      firstFrameSampleRateIndex = currentFrameSampleRateIndex;
    }
    setReadingAdtsHeaderState();
  }
/**
   * Peeks the Adts header of the current frame and checks if it is valid. If the header is valid,
   * transition to {@link #STATE_READING_ADTS_HEADER}; else, transition to {@link
   * #STATE_FINDING_SAMPLE}.
   */
Peeks the Adts header of the current frame and checks if it is valid. If the header is valid,
transition to  #STATE_READING_ADTS_HEADER; else, transition to {@link
#STATE_FINDING_SAMPLE}.
Peeks the Adts header of the current frame and checks if it is valid . If the header is valid transition to #STATE_READING_ADTS_HEADER ; else transition to { @link #STATE_FINDING_SAMPLE } .
private void checkAdtsHeader(ParsableByteArray buffer) {
    if (buffer.bytesLeft() == 0) {
      return;
    }
    adtsScratch.data[0] = buffer.data[buffer.getPosition()];
    adtsScratch.setPosition(2);
    int currentFrameSampleRateIndex = adtsScratch.readBits(4);
    if (firstFrameSampleRateIndex != C.INDEX_UNSET
        && currentFrameSampleRateIndex != firstFrameSampleRateIndex) {
      resetSync();
      return;
    }
    if (!foundFirstFrame) {
      foundFirstFrame = true;
      firstFrameVersion = currentFrameVersion;
      firstFrameSampleRateIndex = currentFrameSampleRateIndex;
    }
    setReadingAdtsHeaderState();
  }
private void checkAdtsHeader ( ParsableByteArray buffer ) { if ( buffer . bytesLeft ( ) == 0 ) { return ; } adtsScratch . data [ 0 ] = buffer . data [ buffer . getPosition ( ) ] ; adtsScratch . setPosition ( 2 ) ; int currentFrameSampleRateIndex = adtsScratch . readBits ( 4 ) ; if ( firstFrameSampleRateIndex != C . INDEX_UNSET && currentFrameSampleRateIndex != firstFrameSampleRateIndex ) { resetSync ( ) ; return ; } if ( ! foundFirstFrame ) { foundFirstFrame = true ; firstFrameVersion = currentFrameVersion ; firstFrameSampleRateIndex = currentFrameSampleRateIndex ; } setReadingAdtsHeaderState ( ) ; }
Peeks the Adts header of the current frame and checks if it is valid.
Peeks the Adts header of the current frame and checks if it is valid .
// Not enough data to check yet, defer this check. // Peek the next byte of buffer into scratch array. // Invalid header.