Suppress connection warnings until 150 frames have come in

This commit is contained in:
Cameron Gutman 2014-09-17 01:58:41 -07:00
parent 5be499887d
commit 5bd30fe3dc

View File

@ -407,6 +407,14 @@ public class ControlStream implements ConnectionStatusListener {
} }
public void connectionDetectedFrameLoss(int firstLostFrame, int nextSuccessfulFrame) { 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) { if (System.currentTimeMillis() > LOSS_PERIOD_MS + lossTimestamp) {
lossCount++; lossCount++;
lossTimestamp = System.currentTimeMillis(); lossTimestamp = System.currentTimeMillis();
@ -420,17 +428,21 @@ public class ControlStream implements ConnectionStatusListener {
lossTimestamp = 0; lossTimestamp = 0;
} }
} }
resyncConnection(firstLostFrame, nextSuccessfulFrame);
} }
public void connectionSinkTooSlow(int firstLostFrame, int 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) { 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."); 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; slowSinkCount = -MAX_SLOW_SINK_COUNT * MESSAGE_DELAY_FACTOR;
} }
resyncConnection(firstLostFrame, nextSuccessfulFrame);
} }
public void connectionReceivedFrame(int frameIndex) { public void connectionReceivedFrame(int frameIndex) {