Package org.jitsi.util
Class RTPUtils
- java.lang.Object
-
- org.jitsi.util.RTPUtils
-
public class RTPUtils extends Object
Deprecated.use org.jitsi.rtp.util.RtpUtils (requires Kotlin)RTP-related static utility methods.- Author:
- Boris Grozev
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<? super Integer>sequenceNumberComparatorDeprecated.AComparatorimplementation for unsigned 16-bitIntegers.
-
Constructor Summary
Constructors Constructor Description RTPUtils()Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intapplySequenceNumberDelta(int startingSequenceNumber, int delta)Deprecated.Apply a delta to a given sequence number and return the result (taking rollover into account)static intas16Bits(int value)Deprecated.Returns the given integer masked to 16 bitsstatic longas32Bits(long value)Deprecated.Returns the given integer masked to 32 bitsstatic intgetSequenceNumberDelta(int a, int b)Deprecated.Returns the delta between two RTP sequence numbers, taking into account rollover.static booleanisNewerTimestampThan(long a, long b)Deprecated.Returns whether or not the first given timestamp is newer than the secondstatic booleanisOlderSequenceNumberThan(int seqNumOne, int seqNumTwo)Deprecated.Returns whether or not seqNumOne is 'older' than seqNumTwo, taking rollover into accountstatic intreadInt(byte[] buf, int off)Deprecated.Read an integer from a buffer at a specified offset.static intreadInt16AsInt(byte[] buf, int off)Deprecated.Read a signed short at a specified offset as an int.static intreadUint16AsInt(byte[] buf, int off)Deprecated.Read an unsigned short at a specified offset as an int.static intreadUint24AsInt(byte[] buf, int off)Deprecated.Read an unsigned short at specified offset as a intstatic longreadUint32AsLong(byte[] buf, int off)Deprecated.Reads a 32-bit unsigned integer from the given buffer at the given offset and returns itslongrepresentation.static longrtpTimestampDiff(long a, long b)Deprecated.Returns the difference between two RTP timestamps.static intsubtractNumber(int a, int b)Deprecated.Returns result of the subtraction of one RTP sequence number from another (modulo 2^16).static StringtoHexString(byte[] buf)Deprecated.Return a string containing the hex string version of the given bytesstatic StringtoHexString(byte[] buf, int off, int len)Deprecated.Return a string containing the hex string version of the given bytestatic StringtoHexString(byte[] buf, int off, int len, boolean format)Deprecated.Return a string containing the hex string version of the given bytestatic intwriteInt(byte[] buf, int off, int data)Deprecated.Set an integer at specified offset in network order.static intwriteShort(byte[] buf, int off, short data)Deprecated.Set an integer at specified offset in network order.static intwriteUint24(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.AComparatorimplementation for unsigned 16-bitIntegers. Comparesaandbinside the [0, 2^16] ring;ais considered smaller thanbif it takes a smaller number to reach fromatobthan the other way round. IMPORTANT: This is a validComparatorimplementation 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)
-
-
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 numberdelta- 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 bufferdata- 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 bufferdata- 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 itslongrepresentation.- 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:
-
-