From a3ebaaf0152fc2f15e6b70c1ac48048ea5b034f7 Mon Sep 17 00:00:00 2001 From: Andy Grundman Date: Sun, 20 Oct 2024 18:39:48 -0400 Subject: [PATCH] Use uint64_t for DECODE_UNIT presentationTimeMs This still holds a millisecond value sourced from RTP timestamp, but since we're changing the API anyway, now is a good time to future-proof this field. --- src/Limelight.h | 2 +- src/RtpVideoQueue.h | 4 ++-- src/VideoDepacketizer.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Limelight.h b/src/Limelight.h index 395083a..7d6f00f 100644 --- a/src/Limelight.h +++ b/src/Limelight.h @@ -167,7 +167,7 @@ typedef struct _DECODE_UNIT { // Presentation time in milliseconds with the epoch at the first captured frame. // This can be used to aid frame pacing or to drop old frames that were queued too // long prior to display. - unsigned int presentationTimeMs; + uint64_t presentationTimeMs; // Length of the entire buffer chain in bytes int fullLength; diff --git a/src/RtpVideoQueue.h b/src/RtpVideoQueue.h index a79ada8..7c3a3d2 100644 --- a/src/RtpVideoQueue.h +++ b/src/RtpVideoQueue.h @@ -7,7 +7,7 @@ typedef struct _RTPV_QUEUE_ENTRY { struct _RTPV_QUEUE_ENTRY* prev; PRTP_PACKET packet; uint64_t receiveTimeUs; - uint32_t presentationTimeMs; + uint64_t presentationTimeMs; int length; bool isParity; } RTPV_QUEUE_ENTRY, *PRTPV_QUEUE_ENTRY; @@ -43,7 +43,7 @@ typedef struct _RTP_VIDEO_QUEUE { uint8_t multiFecCurrentBlockNumber; uint8_t multiFecLastBlockNumber; - uint32_t lastOosFramePresentationTimestamp; + uint64_t lastOosFramePresentationTimestamp; bool receivedOosData; RTP_VIDEO_STATS stats; // the above values are short-lived, this tracks stats for the life of the queue diff --git a/src/VideoDepacketizer.c b/src/VideoDepacketizer.c index c6859ef..fed1b50 100644 --- a/src/VideoDepacketizer.c +++ b/src/VideoDepacketizer.c @@ -20,7 +20,7 @@ static bool strictIdrFrameWait; static uint64_t syntheticPtsBaseUs; static uint16_t frameHostProcessingLatency; static uint64_t firstPacketReceiveTimeUs; -static unsigned int firstPacketPresentationTime; +static uint64_t firstPacketPresentationTime; static bool dropStatePending; static bool idrFrameProcessed; @@ -832,10 +832,10 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, } if (!presentationTimeMs && frameIndex > 0) { - firstPacketPresentationTime = (unsigned int)((receiveTimeUs - syntheticPtsBaseUs) / 1000); + firstPacketPresentationTime = (receiveTimeUs - syntheticPtsBaseUs) / 1000; } else { - firstPacketPresentationTime = (unsigned int)presentationTimeMs; + firstPacketPresentationTime = presentationTimeMs; } }