Class SynchronizerImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getLocalTime​(long ssrc, long rtp0)
      Tries to find the local time (as returned by System.currentTimeMillis()) that corresponds to the RTP timestamp rtpTime for the SSRC ssrc.
      void mapLocalToNtp​(long ssrc, long localTime, double ntpTime)
      Notifies this Synchronizer that the local timestamp localTime corresponds to the NTP timestamp ntpTime (for SSRC ssrc).
      void mapRtpToNtp​(long ssrc, long rtpTime, double ntpTime)
      Notifies this Synchronizer that the RTP timestamp rtpTime (for SSRC ssrc) corresponds to the NTP timestamp ntpTime.
      long readUnsignedIntAsLong​(byte[] buf, int off)
      Read an unsigned integer as long at specified offset
      void setEndpoint​(long ssrc, String endpointId)
      Sets the endpoint identifier for a specific SSRC.
      void setRtpClockRate​(long ssrc, long clockRate)
      Sets the clock rate of the RTP clock for a specific SSRC.
    • Constructor Detail

      • SynchronizerImpl

        public SynchronizerImpl()
    • Method Detail

      • setRtpClockRate

        public void setRtpClockRate​(long ssrc,
                                    long clockRate)
        Sets the clock rate of the RTP clock for a specific SSRC.
        Specified by:
        setRtpClockRate in interface Synchronizer
        Parameters:
        ssrc - the SSRC for which to set the RTP clock rate.
        clockRate - the clock rate.
      • setEndpoint

        public void setEndpoint​(long ssrc,
                                String endpointId)
        Sets the endpoint identifier for a specific SSRC.
        Specified by:
        setEndpoint in interface Synchronizer
        Parameters:
        ssrc - the SSRC for which to set the endpoint identifier.
        endpointId - the endpoint identifier to set.
      • mapRtpToNtp

        public void mapRtpToNtp​(long ssrc,
                                long rtpTime,
                                double ntpTime)
        Notifies this Synchronizer that the RTP timestamp rtpTime (for SSRC ssrc) corresponds to the NTP timestamp ntpTime.
        Specified by:
        mapRtpToNtp in interface Synchronizer
        Parameters:
        ssrc - the SSRC.
        rtpTime - the RTP timestamp which corresponds to ntpTime.
        ntpTime - the NTP timestamp which corresponds to rtpTime.
      • mapLocalToNtp

        public void mapLocalToNtp​(long ssrc,
                                  long localTime,
                                  double ntpTime)
        Notifies this Synchronizer that the local timestamp localTime corresponds to the NTP timestamp ntpTime (for SSRC ssrc).
        Specified by:
        mapLocalToNtp in interface Synchronizer
        Parameters:
        ssrc - the SSRC.
        localTime - the local timestamp which corresponds to ntpTime.
        ntpTime - the NTP timestamp which corresponds to localTime.
      • getLocalTime

        public long getLocalTime​(long ssrc,
                                 long rtp0)
        Tries to find the local time (as returned by System.currentTimeMillis()) that corresponds to the RTP timestamp rtpTime for the SSRC ssrc. Returns -1 if the local time cannot be found (for example because not enough information for the SSRC has been previously provided to the Synchronizer).
        Specified by:
        getLocalTime in interface Synchronizer
        Parameters:
        ssrc - the SSRC with which rtpTime is associated.
        rtp0 - the RTP timestamp
        Returns:
        the local time corresponding to rtpTime for SSRC ssrc if it can be calculated, and -1 otherwise.
      • readUnsignedIntAsLong

        public long readUnsignedIntAsLong​(byte[] buf,
                                          int off)
        Read an unsigned integer as long at specified offset
        Parameters:
        off - start offset of this unsigned integer
        Returns:
        unsigned integer as long at offset