/**
  * Handles and RTCP SDES packet.
  *
  * @param pkt the packet to handle.
  */
 private void addSDES(RawPacket pkt) {
   if (USE_CNAME_AS_ENDPOINT_ID) {
     for (CNAMEItem item : getCnameItems(pkt)) {
       SSRCDesc ssrc = getSSRCDesc(item.ssrc);
       if (ssrc.endpointId == null) {
         synchronized (ssrc) {
           if (ssrc.endpointId == null) ssrc.endpointId = item.cname;
         }
       }
     }
   }
 }
 /**
  * Removes the RTP-NTP mapping for a given SSRC.
  *
  * @param ssrc the SSRC for which to remove the RTP-NTP mapping
  */
 void removeMapping(long ssrc) {
   if (ssrcs.containsKey(ssrc)) {
     synchronized (ssrcs) {
       SSRCDesc ssrcDesc = ssrcs.get(ssrc);
       if (ssrcDesc != null) {
         synchronized (ssrcDesc) {
           ssrcDesc.ntpTime = -1.0;
           ssrcDesc.rtpTime = -1;
         }
       }
     }
   }
 }
  /** {@inheritDoc} */
  public void mapRtpToNtp(long ssrc, long rtpTime, double ntpTime) {
    SSRCDesc ssrcDesc = getSSRCDesc(ssrc);

    if (rtpTime != -1 && ntpTime != -1.0) // have valid values to update
    {
      if (ssrcDesc.rtpTime == -1 || ssrcDesc.ntpTime == -1.0) {
        synchronized (ssrcDesc) {
          if (ssrcDesc.rtpTime == -1 || ssrcDesc.ntpTime == -1.0) {
            ssrcDesc.rtpTime = rtpTime;
            ssrcDesc.ntpTime = ntpTime;
          }
        }
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public void setRtpClockRate(long ssrc, long clockRate) {
   SSRCDesc ssrcDesc = getSSRCDesc(ssrc);
   if (ssrcDesc.clockRate == -1) {
     synchronized (ssrcDesc) {
       if (ssrcDesc.clockRate == -1) ssrcDesc.clockRate = clockRate;
       else if (ssrcDesc.clockRate != clockRate) {
         // this shouldn't happen...but if the clock rate really
         // changed for some reason, out timings are now irrelevant.
         ssrcDesc.clockRate = clockRate;
         ssrcDesc.ntpTime = -1.0;
         ssrcDesc.rtpTime = -1;
       }
     }
   }
 }
 /** {@inheritDoc} */
 public void setEndpoint(long ssrc, String endpointId) {
   SSRCDesc ssrcDesc = getSSRCDesc(ssrc);
   synchronized (ssrcDesc) {
     ssrcDesc.endpointId = endpointId;
   }
 }