/** * 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; } } } }