From 021cfd173784d42677ad9856e78d57d255637cf0 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 27 Nov 2014 21:52:03 -0600 Subject: [PATCH] Lower the maximum RTP queuing delay to 10 ms instead of 40 ms to reduce the number of frames dropped when a packet is lost --- .../src/com/limelight/nvstream/av/video/VideoStream.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moonlight-common/src/com/limelight/nvstream/av/video/VideoStream.java b/moonlight-common/src/com/limelight/nvstream/av/video/VideoStream.java index 061268d7..c0b073e7 100644 --- a/moonlight-common/src/com/limelight/nvstream/av/video/VideoStream.java +++ b/moonlight-common/src/com/limelight/nvstream/av/video/VideoStream.java @@ -25,6 +25,11 @@ public class VideoStream { public static final int FIRST_FRAME_TIMEOUT = 5000; public static final int RTP_RECV_BUFFER = 256 * 1024; + // We can't request an IDR frame until the depacketizer knows + // that a packet was lost. This timeout bounds the time that + // the RTP queue will wait for missing/reordered packets. + public static final int MAX_RTP_QUEUE_DELAY_MS = 10; + // The ring size MUST be greater than or equal to // the maximum number of packets in a fully // presentable frame @@ -201,7 +206,7 @@ public class VideoStream { VideoPacket ring[] = new VideoPacket[VIDEO_RING_SIZE]; VideoPacket queuedPacket; int ringIndex = 0; - RtpReorderQueue rtpQueue = new RtpReorderQueue(); + RtpReorderQueue rtpQueue = new RtpReorderQueue(16, MAX_RTP_QUEUE_DELAY_MS); RtpReorderQueue.RtpQueueStatus queueStatus; // Preinitialize the ring buffer