From 9c37b575108c05940adec41e0ed0313c4682b9bf Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 11 Jun 2017 14:52:56 -0700 Subject: [PATCH] Use a 24-bit rounding mask to correctly round SPI and restore SPI asserts --- src/VideoDepacketizer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/VideoDepacketizer.c b/src/VideoDepacketizer.c index 0149643..5a73649 100644 --- a/src/VideoDepacketizer.c +++ b/src/VideoDepacketizer.c @@ -15,6 +15,8 @@ static int decodingFrame; static int strictIdrFrameWait; static unsigned long long firstPacketReceiveTime; +#define TRUNCATE_24BIT(x) ((x) & 0xFFFFFF) + #define CONSECUTIVE_DROP_LIMIT 120 static int consecutiveFrameDrops; @@ -420,6 +422,7 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, unsigned long l streamPacketIndex = videoPacket->streamPacketIndex; // The packets and frames must be in sequence from the FEC queue + LC_ASSERT(!isBeforeSignedInt(streamPacketIndex, TRUNCATE_24BIT(lastPacketInStream + 1), 0)); LC_ASSERT(!isBeforeSignedInt(frameIndex, nextFrameNumber, 0)); // Notify the listener of the latest frame we've seen from the PC @@ -451,7 +454,7 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, unsigned long l // This must be the first packet in a frame or be contiguous with the last // packet received. - LC_ASSERT(firstPacket || streamPacketIndex == lastPacketInStream + 1); + LC_ASSERT(firstPacket || streamPacketIndex == TRUNCATE_24BIT(lastPacketInStream + 1)); lastPacketInStream = streamPacketIndex;