Package 

Class LinkedPriorityQueue

  • All Implemented Interfaces:
    java.io.Serializable

    
    public class LinkedPriorityQueue
     implements Serializable
                        

    Highly efficient priority queue. Implemented using linked list. We expect that latest frame will be inserted near to the last index. For this case normal linked priority queue will have insertion complexity of O(n). But our implementation should insert it nearly O(1).

    • Constructor Detail

      • LinkedPriorityQueue

        LinkedPriorityQueue(int maxSize, int jitterLength)
        Constructor
        Parameters:
        maxSize - maximum size of the queue, -1 value is considered to be infinite size
        jitterLength - jitter length of this queue, -1 value is considered to be infinite jitter length
    • Method Detail

      • isUniqueSequence

         boolean isUniqueSequence(int sequenceNumber)

        Determines if the given sequence number is unique in this queue.

        Parameters:
        sequenceNumber - Sequence number that need to be checked for uniqueness.
      • enqueue

         void enqueue(RtpFrame packet)

        Enqueue the packet in the in sorted manner.Queue will be sorted whenever a packet is enqueued.If queue size if full, it will remove all the ancient elements and add the new one.

        Parameters:
        packet - instance that need to be inserted into the queue.
      • reset

         void reset()

        If we want to reuse the queue again. we must reset all volatile information.

      • getMissingRange

         int getMissingRange(int lastNACKSequence, ArrayList<LossPacketRange> missingList, int allowedMissCount)

        Check and return the range of missing sequence number.

        Parameters:
        lastNACKSequence - is the latest sequence number for which NACK packet sending check has been done
        missingList - If any miss is found, an instance of LossPacketRange will be added into this listdescribing the range of missing sequence number
        allowedMissCount - allowed distance of next RtpFrame to be considered as missing.
      • getFrame

         RtpFrame getFrame(int sequenceNumber)

        Get the instance of RtpFrame for the given sequence number.

        Parameters:
        sequenceNumber - The sequence number of requested RtpFrame