From d3a7bba6669eff32c63d48c5b970b0f38a4dfea8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 11 Aug 2015 22:49:10 -0700 Subject: [PATCH] Fix an RTP queue bug that can cause extended packet delays when the last packet ages out of the queue --- .../src/com/limelight/nvstream/av/RtpReorderQueue.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/moonlight-common/src/com/limelight/nvstream/av/RtpReorderQueue.java b/moonlight-common/src/com/limelight/nvstream/av/RtpReorderQueue.java index e98494bc..3815aa2a 100644 --- a/moonlight-common/src/com/limelight/nvstream/av/RtpReorderQueue.java +++ b/moonlight-common/src/com/limelight/nvstream/av/RtpReorderQueue.java @@ -171,6 +171,13 @@ public class RtpReorderQueue { // Validate that the queue remains within our contraints RtpQueueEntry lowestEntry = validateQueueConstraints(); + // If the queue is now empty after validating queue constraints, + // this packet can be returned immediately + if (lowestEntry == null && queue.isEmpty()) { + nextRtpSequenceNumber = (short) (packet.getRtpSequenceNumber() + 1); + return RtpQueueStatus.HANDLE_IMMEDIATELY; + } + // Queue has data inside, so we need to see where this packet fits if (packet.getRtpSequenceNumber() == nextRtpSequenceNumber) { // It fits in a hole where we need a packet, now we have some ready