예제 #1
0
  /**
   * Handles an RTCP Sender Report packet.
   *
   * @param pkt the packet to handle.
   * @param localTime the local time of reception of the packet.
   */
  private void addSR(RawPacket pkt, long localTime) {
    long ssrc = pkt.getRTCPSSRC() & 0xffffffffL;
    long rtpTime = pkt.readUnsignedIntAsLong(16);

    long sec = pkt.readUnsignedIntAsLong(8);
    long fract = pkt.readUnsignedIntAsLong(12);
    double ntpTime = sec + (((double) fract) / (1L << 32));

    if (localTime != -1 && ntpTime != -1.0) mapLocalToNtp(ssrc, localTime, ntpTime);

    if (rtpTime != -1 && ntpTime != -1.0) mapRtpToNtp(ssrc, rtpTime, ntpTime);
  }
예제 #2
0
            @Override
            public RawPacket reverseTransform(RawPacket pkt) {
              RecorderRtpImpl.this.handleRtcpPacket(pkt);
              if (pkt != null && pkt.getRTCPPayloadType() == 203) {
                // An RTCP BYE packet. Remove the receive stream before
                // it gets to FMJ, because we want to, for example,
                // flush the packet buffer before that.

                long ssrc = pkt.getRTCPSSRC() & 0xffffffffl;
                if (logger.isInfoEnabled()) logger.info("RTCP BYE for SSRC=" + ssrc);

                ReceiveStreamDesc receiveStream = findReceiveStream(ssrc);
                if (receiveStream != null) removeReceiveStream(receiveStream, false);
              }

              return pkt;
            }