mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-16 22:00:55 +00:00
Allow applications to reliably calculate decode unit queue delay
This commit is contained in:
+9
-3
@@ -136,11 +136,17 @@ typedef struct _DECODE_UNIT {
|
|||||||
// Frame type
|
// Frame type
|
||||||
int frameType;
|
int frameType;
|
||||||
|
|
||||||
// Receive time of first buffer. This value uses an implementation-defined epoch.
|
// Receive time of first buffer. This value uses an implementation-defined epoch,
|
||||||
// To compute actual latency values, use LiGetMillis() to get a timestamp that
|
// but the same epoch as enqueueTimeMs and LiGetMillis().
|
||||||
// shares the same epoch as this value.
|
|
||||||
uint64_t receiveTimeMs;
|
uint64_t receiveTimeMs;
|
||||||
|
|
||||||
|
// Time the frame was fully assembled and queued for the video decoder to process.
|
||||||
|
// This is also approximately the same time as the final packet was received, so
|
||||||
|
// enqueueTimeMs - receiveTimeMs is the time taken to receive the frame. At the
|
||||||
|
// time the decode unit is passed to submitDecodeUnit(), the total queue delay
|
||||||
|
// can be calculated by LiGetMillis() - enqueueTimeMs.
|
||||||
|
uint64_t enqueueTimeMs;
|
||||||
|
|
||||||
// Presentation time in milliseconds with the epoch at the first captured frame.
|
// 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
|
// This can be used to aid frame pacing or to drop old frames that were queued too
|
||||||
// long prior to display.
|
// long prior to display.
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ static void reassembleFrame(int frameNumber) {
|
|||||||
qdu->decodeUnit.frameNumber = frameNumber;
|
qdu->decodeUnit.frameNumber = frameNumber;
|
||||||
qdu->decodeUnit.receiveTimeMs = firstPacketReceiveTime;
|
qdu->decodeUnit.receiveTimeMs = firstPacketReceiveTime;
|
||||||
qdu->decodeUnit.presentationTimeMs = firstPacketPresentationTime;
|
qdu->decodeUnit.presentationTimeMs = firstPacketPresentationTime;
|
||||||
|
qdu->decodeUnit.enqueueTimeMs = LiGetMillis();
|
||||||
|
|
||||||
// IDR frames will have leading CSD buffers
|
// IDR frames will have leading CSD buffers
|
||||||
if (nalChainHead->bufferType != BUFFER_TYPE_PICDATA) {
|
if (nalChainHead->bufferType != BUFFER_TYPE_PICDATA) {
|
||||||
|
|||||||
Reference in New Issue
Block a user