Class RTPUtils


  • public class RTPUtils
    extends Object
    Deprecated.
    use org.jitsi.rtp.util.RtpUtils (requires Kotlin)
    RTP-related static utility methods.
    Author:
    Boris Grozev
    • Constructor Summary

      Constructors 
      Constructor Description
      RTPUtils()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static int applySequenceNumberDelta​(int startingSequenceNumber, int delta)
      Deprecated.
      Apply a delta to a given sequence number and return the result (taking rollover into account)
      static int as16Bits​(int value)
      Deprecated.
      Returns the given integer masked to 16 bits
      static long as32Bits​(long value)
      Deprecated.
      Returns the given integer masked to 32 bits
      static int getSequenceNumberDelta​(int a, int b)
      Deprecated.
      Returns the delta between two RTP sequence numbers, taking into account rollover.
      static boolean isNewerTimestampThan​(long a, long b)
      Deprecated.
      Returns whether or not the first given timestamp is newer than the second
      static boolean isOlderSequenceNumberThan​(int seqNumOne, int seqNumTwo)
      Deprecated.
      Returns whether or not seqNumOne is 'older' than seqNumTwo, taking rollover into account
      static int readInt​(byte[] buf, int off)
      Deprecated.
      Read an integer from a buffer at a specified offset.
      static int readInt16AsInt​(byte[] buf, int off)
      Deprecated.
      Read a signed short at a specified offset as an int.
      static int readUint16AsInt​(byte[] buf, int off)
      Deprecated.
      Read an unsigned short at a specified offset as an int.
      static int readUint24AsInt​(byte[] buf, int off)
      Deprecated.
      Read an unsigned short at specified offset as a int
      static long readUint32AsLong​(byte[] buf, int off)
      Deprecated.
      Reads a 32-bit unsigned integer from the given buffer at the given offset and returns its long representation.
      static long rtpTimestampDiff​(long a, long b)
      Deprecated.
      Returns the difference between two RTP timestamps.
      static int subtractNumber​(int a, int b)
      Deprecated.
      Returns result of the subtraction of one RTP sequence number from another (modulo 2^16).
      static String toHexString​(byte[] buf)
      Deprecated.
      Return a string containing the hex string version of the given bytes
      static String toHexString​(byte[] buf, int off, int len)
      Deprecated.
      Return a string containing the hex string version of the given byte
      static String toHexString​(byte[] buf, int off, int len, boolean format)
      Deprecated.
      Return a string containing the hex string version of the given byte
      static int writeInt​(byte[] buf, int off, int data)
      Deprecated.
      Set an integer at specified offset in network order.
      static int writeShort​(byte[] buf, int off, short data)
      Deprecated.
      Set an integer at specified offset in network order.
      static int writeUint24​(byte[] buf, int off, int data)
      Deprecated.
      Writes the least significant 24 bits from the given integer into the given byte array at the given offset.
    • Field Detail

      • sequenceNumberComparator

        public static final Comparator<? super Integer> sequenceNumberComparator
        Deprecated.
        A Comparator implementation for unsigned 16-bit Integers. Compares a and b inside the [0, 2^16] ring; a is considered smaller than b if it takes a smaller number to reach from a to b than the other way round. IMPORTANT: This is a valid Comparator implementation only when used for subsets of [0, 2^16) which don't span more than 2^15 elements. E.g. it works for: [0, 2^15-1] and ([50000, 2^16) u [0, 10000]) Doesn't work for: [0, 2^15] and ([0, 2^15-1] u {2^16-1}) and [0, 2^16)
    • Constructor Detail

      • RTPUtils

        public RTPUtils()
        Deprecated.
    • Method Detail

      • getSequenceNumberDelta

        public static int getSequenceNumberDelta​(int a,
                                                 int b)
        Deprecated.
        Returns the delta between two RTP sequence numbers, taking into account rollover. This will return the 'shortest' delta between the two sequence numbers in the form of the number you'd add to b to get a. e.g.: getSequenceNumberDelta(1, 10) -> -9 (10 + -9 = 1) getSequenceNumberDelta(1, 65530) -> 7 (65530 + 7 = 1)
        Returns:
        the delta between two RTP sequence numbers (modulo 2^16).
      • isOlderSequenceNumberThan

        public static boolean isOlderSequenceNumberThan​(int seqNumOne,
                                                        int seqNumTwo)
        Deprecated.
        Returns whether or not seqNumOne is 'older' than seqNumTwo, taking rollover into account
        Parameters:
        seqNumOne -
        seqNumTwo -
        Returns:
        true if seqNumOne is 'older' than seqNumTwo
      • subtractNumber

        public static int subtractNumber​(int a,
                                         int b)
        Deprecated.
        Returns result of the subtraction of one RTP sequence number from another (modulo 2^16).
        Returns:
        result of the subtraction of one RTP sequence number from another (modulo 2^16).
      • applySequenceNumberDelta

        public static int applySequenceNumberDelta​(int startingSequenceNumber,
                                                   int delta)
        Deprecated.
        Apply a delta to a given sequence number and return the result (taking rollover into account)
        Parameters:
        startingSequenceNumber - the starting sequence number
        delta - the delta to be applied
        Returns:
        the sequence number result from doing startingSequenceNumber + delta
      • writeInt

        public static int writeInt​(byte[] buf,
                                   int off,
                                   int data)
        Deprecated.
        Set an integer at specified offset in network order.
        Parameters:
        off - Offset into the buffer
        data - The integer to store in the packet
      • writeUint24

        public static int writeUint24​(byte[] buf,
                                      int off,
                                      int data)
        Deprecated.
        Writes the least significant 24 bits from the given integer into the given byte array at the given offset.
        Parameters:
        buf - the buffer into which to write.
        off - the offset at which to write.
        data - the integer to write.
        Returns:
        3
      • writeShort

        public static int writeShort​(byte[] buf,
                                     int off,
                                     short data)
        Deprecated.
        Set an integer at specified offset in network order.
        Parameters:
        off - Offset into the buffer
        data - The integer to store in the packet
      • readInt

        public static int readInt​(byte[] buf,
                                  int off)
        Deprecated.
        Read an integer from a buffer at a specified offset.
        Parameters:
        buf - the buffer.
        off - start offset of the integer to be read.
      • readUint32AsLong

        public static long readUint32AsLong​(byte[] buf,
                                            int off)
        Deprecated.
        Reads a 32-bit unsigned integer from the given buffer at the given offset and returns its long representation.
        Parameters:
        buf - the buffer.
        off - start offset of the integer to be read.
      • readUint16AsInt

        public static int readUint16AsInt​(byte[] buf,
                                          int off)
        Deprecated.
        Read an unsigned short at a specified offset as an int.
        Parameters:
        buf - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:
        the int value of the unsigned short at offset
      • readInt16AsInt

        public static int readInt16AsInt​(byte[] buf,
                                         int off)
        Deprecated.
        Read a signed short at a specified offset as an int.
        Parameters:
        buf - the buffer from which to read.
        off - start offset of the unsigned short
        Returns:
        the int value of the unsigned short at offset
      • readUint24AsInt

        public static int readUint24AsInt​(byte[] buf,
                                          int off)
        Deprecated.
        Read an unsigned short at specified offset as a int
        Parameters:
        buf -
        off - start offset of the unsigned short
        Returns:
        the int value of the unsigned short at offset
      • as16Bits

        public static int as16Bits​(int value)
        Deprecated.
        Returns the given integer masked to 16 bits
        Parameters:
        value - the integer to mask
        Returns:
        the value, masked to only keep the lower 16 bits
      • as32Bits

        public static long as32Bits​(long value)
        Deprecated.
        Returns the given integer masked to 32 bits
        Parameters:
        value - the integer to mask
        Returns:
        the value, masked to only keep the lower 32 bits
      • rtpTimestampDiff

        public static long rtpTimestampDiff​(long a,
                                            long b)
        Deprecated.
        Returns the difference between two RTP timestamps.
        Returns:
        the difference between two RTP timestamps.
      • isNewerTimestampThan

        public static boolean isNewerTimestampThan​(long a,
                                                   long b)
        Deprecated.
        Returns whether or not the first given timestamp is newer than the second
        Parameters:
        a -
        b -
        Returns:
        true if a is newer than b, false otherwise
      • toHexString

        public static String toHexString​(byte[] buf)
        Deprecated.
        Return a string containing the hex string version of the given bytes
        Parameters:
        buf -
        Returns:
      • toHexString

        public static String toHexString​(byte[] buf,
                                         int off,
                                         int len)
        Deprecated.
        Return a string containing the hex string version of the given byte
        Parameters:
        buf -
        off -
        len -
        Returns:
      • toHexString

        public static String toHexString​(byte[] buf,
                                         int off,
                                         int len,
                                         boolean format)
        Deprecated.
        Return a string containing the hex string version of the given byte
        Parameters:
        buf -
        off -
        len -
        format - a boolean that indicates whether or not to format the hex string.
        Returns: