code: public void transformPacket(RawPacket pkt) {
          boolean encrypt = false;
          // Encrypt the packet using Counter Mode encryption
          if (policy.getEncType() == SRTPPolicy.AESCM_ENCRYPTION || policy.getEncType() == SRTPPolicy.TWOFISH_ENCRYPTION) {
              processPacketAESCM(pkt, sentIndex);
              encrypt = true;
          }
  
          // Encrypt the packet using F8 Mode encryption
          else if (policy.getEncType() == SRTPPolicy.AESF8_ENCRYPTION || policy.getEncType() == SRTPPolicy.TWOFISHF8_ENCRYPTION) {
              processPacketAESF8(pkt, sentIndex);
              encrypt = true;
          }
          
          int index = 0;
          if (encrypt) {
              index = sentIndex | 0x80000000;
          }
          
          // Grow packet storage in one step
          pkt.grow(4 + policy.getAuthTagLength());
  
          // Authenticate the packet
          // The authenticate method gets the index via parameter and stores
          // it in network order in rbStore variable. 
          if (policy.getAuthType() != SRTPPolicy.NULL_AUTHENTICATION) {
              authenticatePacket(pkt, index);
              pkt.append(rbStore, 4);
              pkt.append(tagStore, policy.getAuthTagLength());
          }
          sentIndex++;
          sentIndex &= ~0x80000000;       // clear possible overflow
      }
docs: Transform a RTP packet into a SRTP packet.
  This method is called when a normal RTP packet ready to be sent.
  
  Operations done by the transformation may include: encryption, using
  either Counter Mode encryption, or F8 Mode encryption, adding
  authentication tag, currently HMC SHA1 method.
  
  Both encryption and authentication functionality can be turned off
  as long as the SRTPPolicy used in this SRTPCryptoContext is requires no
  encryption and no authentication. Then the packet will be sent out
  untouched. However this is not encouraged. If no SRTP feature is enabled,
  then we shall not use SRTP TransformConnector. We should use the original
  method (RTPManager managed transportation) instead.
  
  @param pkt the RTP packet that is going to be sent out