Code example for PriorityQueue

Methods: add, remove, size

0
         } 
      } 
 
      // If this sequence number already exists, it's a dup.  Drop it. 
      // (actually, remove the one in the queue, and add this one again.) 
      if (queue.remove(rtpPacket))
      { 
         LOG.debug(String.format("JitterBuffer::add sequence duplication "+rtpPacket.getSequenceNumber())) ;
         return queue.add(rtpPacket) ;
      } 
       
      // If the queue is full, toss the last packet to make room. 
      if (queue.size() >= maxDepth)
      { 
         removeRtpPacket() ; 
      } 
       
//      LOG.debug(String.format("sequence added "+rtpPacket.getSequenceNumber())) ; 
      return queue.add(rtpPacket) ;
   } 
    
   /** 
    * Remove the next available RtpPacket from the Jitter Buffer, in sequence number 
    * order.