Package org.jitsi.impl.neomedia.rtcp
Class NACKPacket
- java.lang.Object
-
- net.sf.fmj.media.rtp.util.Packet
-
- net.sf.fmj.media.rtp.RTCPPacket
-
- org.jitsi.impl.neomedia.rtcp.RTCPFBPacket
-
- org.jitsi.impl.neomedia.rtcp.NACKPacket
-
public class NACKPacket extends RTCPFBPacket
A class which represents an RTCP Generic NACK feedback message, as defined in RFC4585 Section 6.2.1. The RTCP packet structure is:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |V=2|P| FMT=1 | PT=205 | length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SSRC of packet sender | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SSRC of media source | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FCI | | [...] | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ The Feedback Control Information (FCI) field consists of one or more 32-bit words, each with the following structure: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PID | BLP | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Author:
- Boris Grozev, George Politis
-
-
Field Summary
Fields Modifier and Type Field Description static intFMTThe value of the "fmt" field for a NACK packet.-
Fields inherited from class org.jitsi.impl.neomedia.rtcp.RTCPFBPacket
fci, fmt, PSFB, RTPFB, senderSSRC, sourceSSRC
-
-
Constructor Summary
Constructors Constructor Description NACKPacket(long senderSSRC, long sourceSSRC, Collection<Integer> lostPackets)Initializes a new NACKPacket instance with specific "packet sender SSRC" and "media source SSRC" values and which describes a specific set of sequence numbers.NACKPacket(net.sf.fmj.media.rtp.RTCPCompoundPacket base)Initializes a new NACKPacket instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Integer>getLostPackets()static Collection<Integer>getLostPackets(org.jitsi.utils.ByteArrayBuffer baf)static Collection<Integer>getLostPacketsFci(org.jitsi.utils.ByteArrayBuffer fciBuffer)static booleanisNACKPacket(org.jitsi.utils.ByteArrayBuffer baf)Gets a boolean indicating whether or not the RTCP packet specified in theByteArrayBufferthat is passed as an argument is a NACK packet or not.StringtoString()-
Methods inherited from class org.jitsi.impl.neomedia.rtcp.RTCPFBPacket
assemble, calcLength, getFCI, getSenderSSRC, getSourceSSRC, getSourceSSRC, isPSFBPacket, isRTCPFBPacket, isRTPFBPacket, toRawPacket
-
-
-
-
Field Detail
-
FMT
public static final int FMT
The value of the "fmt" field for a NACK packet.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NACKPacket
public NACKPacket(net.sf.fmj.media.rtp.RTCPCompoundPacket base)
Initializes a new NACKPacket instance.- Parameters:
base-
-
NACKPacket
public NACKPacket(long senderSSRC, long sourceSSRC, Collection<Integer> lostPackets)Initializes a new NACKPacket instance with specific "packet sender SSRC" and "media source SSRC" values and which describes a specific set of sequence numbers.- Parameters:
senderSSRC- the value to use for the "packet sender SSRC" field.sourceSSRC- the value to use for the "media source SSRC" field.lostPackets- the set of RTP sequence numbers which this NACK packet is to describe. Note that this implementation is not optimized and might not always use the minimal possible number of bytes to describe a given set of packets. Specifically, it does not take into account that sequence numbers wrap at 2^16 and fails to pack numbers close to 2^16 with those close to 0.
-
-
Method Detail
-
isNACKPacket
public static boolean isNACKPacket(org.jitsi.utils.ByteArrayBuffer baf)
Gets a boolean indicating whether or not the RTCP packet specified in theByteArrayBufferthat is passed as an argument is a NACK packet or not.- Parameters:
baf- theByteArrayBuffer- Returns:
- true if the byte array buffer holds a NACK packet, otherwise false.
-
getLostPackets
public static Collection<Integer> getLostPackets(org.jitsi.utils.ByteArrayBuffer baf)
- Parameters:
baf- the NACK packet.- Returns:
- the set of sequence numbers reported lost in a NACK packet
represented by a
ByteArrayBuffer.
-
getLostPacketsFci
public static Collection<Integer> getLostPacketsFci(org.jitsi.utils.ByteArrayBuffer fciBuffer)
- Parameters:
fciBuffer- theByteArrayBufferwhich represents the FCI field of a NACK packet.- Returns:
- the set of sequence numbers reported lost in the FCI field of a
NACK packet represented by a
ByteArrayBuffer.
-
getLostPackets
public Collection<Integer> getLostPackets()
- Returns:
- the set of sequence numbers reported lost in this NACK packet.
-
toString
public String toString()
- Overrides:
toStringin classRTCPFBPacket
-
-