From 97ca7b099f808f08c49b7a50dbf63b5082a3f5fd Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 24 Dec 2020 11:05:08 -0600 Subject: [PATCH] Report frames to the control stream code before FEC reconstruction --- src/ControlStream.c | 2 ++ src/RtpFecQueue.c | 6 +++++- src/VideoDepacketizer.c | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ControlStream.c b/src/ControlStream.c index c8a30e5..ce75c92 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -282,6 +282,8 @@ void connectionReceivedCompleteFrame(int frameIndex) { } void connectionSawFrame(int frameIndex) { + LC_ASSERT(!isBefore16(frameIndex, lastSeenFrame)); + uint64_t now = PltGetMillis(); if (now - intervalStartTimeMs >= CONN_STATUS_SAMPLE_PERIOD) { if (intervalTotalFrameCount != 0) { diff --git a/src/RtpFecQueue.c b/src/RtpFecQueue.c index f2ee55d..1902e71 100644 --- a/src/RtpFecQueue.c +++ b/src/RtpFecQueue.c @@ -433,7 +433,11 @@ int RtpfAddPacket(PRTP_FEC_QUEUE queue, PRTP_PACKET packet, int length, PRTPFEC_ } queue->currentFrameNumber = nvPacket->frameIndex; - + + // Tell the control stream logic about this frame, even if we don't end up + // being able to reconstruct a full frame from it. + connectionSawFrame(queue->currentFrameNumber); + // Discard any unsubmitted buffers from the previous frame while (queue->bufferHead != NULL) { PRTPFEC_QUEUE_ENTRY entry = queue->bufferHead; diff --git a/src/VideoDepacketizer.c b/src/VideoDepacketizer.c index 96a14e3..cee8304 100644 --- a/src/VideoDepacketizer.c +++ b/src/VideoDepacketizer.c @@ -530,9 +530,6 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, dropFrameState(); return; } - - // Notify the listener of the latest frame we've seen from the PC - connectionSawFrame(frameIndex); // Verify that we didn't receive an incomplete frame LC_ASSERT(firstPacket ^ decodingFrame);