code: boolean checkReplay(int index) {
          // compute the index of previously received packet and its
          // delta to the new received packet
          long delta = index - receivedIndex;
  
          if (delta > 0) {
              /* Packet not yet received */
              return true;
          } else {
              if (-delta > REPLAY_WINDOW_SIZE) {
                  /* Packet too old */
                  return false;
              } else {
                  if (((this.replayWindow >> (-delta)) & 0x1) != 0) {
                      /* Packet already received ! */
                      return false;
                  } else {
                      /* Packet not yet received */
                      return true;
                  }
              }
          }
      }
docs: Checks if a packet is a replayed on based on its sequence number.
  
  This method supports a 64 packet history relative the the given
  sequence number.
  
  Sequence Number is guaranteed to be real (not faked) through
  authentication.
  
  @param index index number of the SRTCP packet
  @return true if this sequence number indicates the packet is not a
  replayed one, false if not