mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-24 13:41:23 +00:00
Suppress connection warnings for the first sampling period
This commit is contained in:
@@ -63,6 +63,7 @@ static uint64_t intervalStartTimeMs;
|
|||||||
static int lastIntervalLossPercentage;
|
static int lastIntervalLossPercentage;
|
||||||
static int lastConnectionStatusUpdate;
|
static int lastConnectionStatusUpdate;
|
||||||
static int currentEnetSequenceNumber;
|
static int currentEnetSequenceNumber;
|
||||||
|
static uint64_t firstFrameTimeMs;
|
||||||
|
|
||||||
static LINKED_BLOCKING_QUEUE invalidReferenceFrameTuples;
|
static LINKED_BLOCKING_QUEUE invalidReferenceFrameTuples;
|
||||||
static LINKED_BLOCKING_QUEUE frameFecStatusQueue;
|
static LINKED_BLOCKING_QUEUE frameFecStatusQueue;
|
||||||
@@ -296,6 +297,7 @@ int initializeControlStream(void) {
|
|||||||
intervalStartTimeMs = 0;
|
intervalStartTimeMs = 0;
|
||||||
lastIntervalLossPercentage = 0;
|
lastIntervalLossPercentage = 0;
|
||||||
lastConnectionStatusUpdate = CONN_STATUS_OKAY;
|
lastConnectionStatusUpdate = CONN_STATUS_OKAY;
|
||||||
|
firstFrameTimeMs = 0;
|
||||||
currentEnetSequenceNumber = 0;
|
currentEnetSequenceNumber = 0;
|
||||||
usePeriodicPing = APP_VERSION_AT_LEAST(7, 1, 415);
|
usePeriodicPing = APP_VERSION_AT_LEAST(7, 1, 415);
|
||||||
encryptionCtx = PltCreateCryptoContext();
|
encryptionCtx = PltCreateCryptoContext();
|
||||||
@@ -394,6 +396,19 @@ void connectionSawFrame(int frameIndex) {
|
|||||||
LC_ASSERT(!isBefore16(frameIndex, lastSeenFrame));
|
LC_ASSERT(!isBefore16(frameIndex, lastSeenFrame));
|
||||||
|
|
||||||
uint64_t now = PltGetMillis();
|
uint64_t now = PltGetMillis();
|
||||||
|
|
||||||
|
// Suppress connection status warnings for the first sampling period
|
||||||
|
// to allow the network and host to settle.
|
||||||
|
if (lastSeenFrame == 0) {
|
||||||
|
lastSeenFrame = frameIndex;
|
||||||
|
firstFrameTimeMs = now;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (now - firstFrameTimeMs < CONN_STATUS_SAMPLE_PERIOD) {
|
||||||
|
lastSeenFrame = frameIndex;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (now - intervalStartTimeMs >= CONN_STATUS_SAMPLE_PERIOD) {
|
if (now - intervalStartTimeMs >= CONN_STATUS_SAMPLE_PERIOD) {
|
||||||
if (intervalTotalFrameCount != 0) {
|
if (intervalTotalFrameCount != 0) {
|
||||||
// Notify the client of connection status changes based on frame loss rate
|
// Notify the client of connection status changes based on frame loss rate
|
||||||
|
|||||||
Reference in New Issue
Block a user