/** {@inheritDoc} */
        @Override
        public RawPacket transform(RawPacket pkt) {
          if (pkt == null) {
            return pkt;
          }

          RTCPCompoundPacket inPacket;
          try {
            inPacket =
                (RTCPCompoundPacket)
                    parser.parse(pkt.getBuffer(), pkt.getOffset(), pkt.getLength());
          } catch (BadFormatException e) {
            logger.warn("Failed to terminate an RTCP packet. " + "Dropping packet.");
            return null;
          }

          // Update our RTCP stats map (timestamps). This operation is
          // read-only.
          remoteClockEstimator.apply(inPacket);

          cnameRegistry.update(inPacket);

          // Remove SRs and RRs from the RTCP packet.
          pkt = feedbackGateway.gateway(inPacket);

          return pkt;
        }
    @Override
    public RawPacket transform(RawPacket p) {
      // Update octets and packets sent in SRs.
      RTCPCompoundPacket compound;

      try {
        compound = (RTCPCompoundPacket) parser.parse(p.getBuffer(), p.getOffset(), p.getLength());
      } catch (BadFormatException e) {
        logger.warn("Failed to terminate an RTCP packet. Dropping it.");
        return null;
      }

      if (srGateway.gateway(compound)) {
        return generator.apply(compound);
      } else {
        // If the RTCP packet hasn't been modified, send the input
        // without regenerating it (i.e. optimize).
        return p;
      }
    }