From 9dffde74b22b4795bf0d72d0a3ede7ce0999b415 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 25 Jul 2021 13:44:39 +1000 Subject: [PATCH] [client] main: skip duplicate frames When a new client connects to our session the host will repeat the last valid frame for the new client. This change will detect this and skip the duplicated frame. --- client/src/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index dc4c0783..ed74d97a 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -424,8 +424,9 @@ int main_frameThread(void * unused) LGMP_STATUS status; PLGMPClientQueue queue; - uint32_t formatVer = 0; - size_t dataSize = 0; + uint32_t frameSerial = 0; + uint32_t formatVer = 0; + size_t dataSize = 0; LG_RendererFormat lgrFormat; struct DMAFrameInfo dmaInfo[LGMP_Q_FRAME_LEN] = {0}; @@ -495,6 +496,16 @@ int main_frameThread(void * unused) } KVMFRFrame * frame = (KVMFRFrame *)msg.mem; + + // ignore any repeated frames, this happens when a new client connects to + // the same host application. + if (frame->frameSerial == frameSerial) + { + lgmpClientMessageDone(queue); + continue; + } + frameSerial = frame->frameSerial; + struct DMAFrameInfo *dma = NULL; if (!g_state.formatValid || frame->formatVer != formatVer)