diff --git a/src/org/ice4j/ice/harvest/SinglePortUdpHarvester.java b/src/org/ice4j/ice/harvest/SinglePortUdpHarvester.java index b395f35..78200c0 100644 --- a/src/org/ice4j/ice/harvest/SinglePortUdpHarvester.java +++ b/src/org/ice4j/ice/harvest/SinglePortUdpHarvester.java @@ -459,9 +459,14 @@ public class SinglePortUdpHarvester { synchronized (queue) { - // XXX Should we drop the first packet from the queue instead? - if (!queue.offer(buf)) + // Drop the first rather than the current packet, so that + // receivers can notice the loss earlier. + if (queue.size() == QUEUE_SIZE) + { logger.info("Dropping a packet because the queue is full."); + queue.poll(); + } + queue.offer(buf); queue.notifyAll(); }