From 5bd30fe3dc9388ca73b7de0c4f05c6b28eff2530 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 17 Sep 2014 01:58:41 -0700 Subject: [PATCH] Suppress connection warnings until 150 frames have come in --- .../nvstream/control/ControlStream.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java b/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java index 6df53470..b34fceb8 100644 --- a/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java +++ b/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java @@ -407,6 +407,14 @@ public class ControlStream implements ConnectionStatusListener { } public void connectionDetectedFrameLoss(int firstLostFrame, int nextSuccessfulFrame) { + resyncConnection(firstLostFrame, nextSuccessfulFrame); + + // Suppress connection warnings for the first 150 frames to allow the connection + // to stabilize + if (currentFrame < 150) { + return; + } + if (System.currentTimeMillis() > LOSS_PERIOD_MS + lossTimestamp) { lossCount++; lossTimestamp = System.currentTimeMillis(); @@ -420,17 +428,21 @@ public class ControlStream implements ConnectionStatusListener { lossTimestamp = 0; } } - - resyncConnection(firstLostFrame, nextSuccessfulFrame); } public void connectionSinkTooSlow(int firstLostFrame, int nextSuccessfulFrame) { + resyncConnection(firstLostFrame, nextSuccessfulFrame); + + // Suppress connection warnings for the first 150 frames to allow the connection + // to stabilize + if (currentFrame < 150) { + return; + } + if (++slowSinkCount == MAX_SLOW_SINK_COUNT) { listener.displayTransientMessage("Your device is processing the A/V data too slowly. Try lowering stream resolution and/or frame rate."); slowSinkCount = -MAX_SLOW_SINK_COUNT * MESSAGE_DELAY_FACTOR; } - - resyncConnection(firstLostFrame, nextSuccessfulFrame); } public void connectionReceivedFrame(int frameIndex) {