Class 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 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 the ByteArrayBuffer that is passed as an argument is a NACK packet or not.
        Parameters:
        baf - the ByteArrayBuffer
        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 - the ByteArrayBuffer which 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.