mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Fetch receive time only once per frame instead of once per packet
This commit is contained in:
parent
fe7cb006da
commit
0b8dc80823
@ -44,7 +44,6 @@ static int queuePacket(PRTP_FEC_QUEUE queue, PRTPFEC_QUEUE_ENTRY newEntry, int h
|
||||
newEntry->packet = packet;
|
||||
newEntry->length = length;
|
||||
newEntry->isParity = isParity;
|
||||
newEntry->receiveTimeMs = PltGetMillis();
|
||||
newEntry->prev = NULL;
|
||||
newEntry->next = NULL;
|
||||
|
||||
@ -266,6 +265,13 @@ static void submitCompletedFrame(PRTP_FEC_QUEUE queue) {
|
||||
removeEntry(queue, entry);
|
||||
entry->prev = entry->next = NULL;
|
||||
|
||||
// To avoid having to sample the system time for each packet, we cheat
|
||||
// and use the first packet's receive time for all packets. This ends up
|
||||
// actually being better for the measurements that the depacketizer does,
|
||||
// since it properly handles out of order packets.
|
||||
LC_ASSERT(queue->bufferFirstRecvTimeMs != 0);
|
||||
entry->receiveTimeMs = queue->bufferFirstRecvTimeMs;
|
||||
|
||||
// Submit this packet for decoding. It will own freeing the entry now.
|
||||
queueRtpPacket(entry);
|
||||
break;
|
||||
@ -331,6 +337,7 @@ int RtpfAddPacket(PRTP_FEC_QUEUE queue, PRTP_PACKET packet, int length, PRTPFEC_
|
||||
queue->bufferTail = NULL;
|
||||
queue->bufferSize = 0;
|
||||
|
||||
queue->bufferFirstRecvTimeMs = PltGetMillis();
|
||||
queue->bufferLowestSequenceNumber = U16(packet->sequenceNumber - fecIndex);
|
||||
queue->nextContiguousSequenceNumber = queue->bufferLowestSequenceNumber;
|
||||
queue->receivedBufferDataPackets = 0;
|
||||
|
@ -15,6 +15,7 @@ typedef struct _RTPFEC_QUEUE_ENTRY {
|
||||
typedef struct _RTP_FEC_QUEUE {
|
||||
PRTPFEC_QUEUE_ENTRY bufferHead;
|
||||
PRTPFEC_QUEUE_ENTRY bufferTail;
|
||||
unsigned long long bufferFirstRecvTimeMs;
|
||||
int bufferSize;
|
||||
int bufferLowestSequenceNumber;
|
||||
int bufferHighestSequenceNumber;
|
||||
|
@ -669,6 +669,9 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, unsigned long l
|
||||
void queueRtpPacket(PRTPFEC_QUEUE_ENTRY queueEntry) {
|
||||
int dataOffset;
|
||||
|
||||
LC_ASSERT(!queueEntry->isParity);
|
||||
LC_ASSERT(queueEntry->receiveTimeMs != 0);
|
||||
|
||||
dataOffset = sizeof(*queueEntry->packet);
|
||||
if (queueEntry->packet->header & FLAG_EXTENSION) {
|
||||
dataOffset += 4; // 2 additional fields
|
||||
|
Loading…
x
Reference in New Issue
Block a user