mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-22 00:31:09 +00:00
Distinguish speculative RFIs from normal FEC-initiated RFIs
This commit is contained in:
@@ -98,7 +98,7 @@ void destroyVideoDepacketizer(void);
|
|||||||
void queueRtpPacket(PRTPV_QUEUE_ENTRY queueEntry);
|
void queueRtpPacket(PRTPV_QUEUE_ENTRY queueEntry);
|
||||||
void stopVideoDepacketizer(void);
|
void stopVideoDepacketizer(void);
|
||||||
void requestDecoderRefresh(void);
|
void requestDecoderRefresh(void);
|
||||||
void notifyFrameLost(unsigned int frameNumber);
|
void notifyFrameLost(unsigned int frameNumber, bool speculative);
|
||||||
|
|
||||||
void initializeVideoStream(void);
|
void initializeVideoStream(void);
|
||||||
void destroyVideoStream(void);
|
void destroyVideoStream(void);
|
||||||
|
|||||||
+5
-5
@@ -177,14 +177,14 @@ static int reconstructFrame(PRTP_VIDEO_QUEUE queue) {
|
|||||||
if (queue->missingDataPackets > queue->bufferParityPackets) {
|
if (queue->missingDataPackets > queue->bufferParityPackets) {
|
||||||
// If the number of missing data shards exceeds the total number of possible parity shards,
|
// If the number of missing data shards exceeds the total number of possible parity shards,
|
||||||
// we will presume the frame is lost.
|
// we will presume the frame is lost.
|
||||||
notifyFrameLost(queue->currentFrameNumber);
|
notifyFrameLost(queue->currentFrameNumber, true);
|
||||||
queue->reportedLostFrame = true;
|
queue->reportedLostFrame = true;
|
||||||
}
|
}
|
||||||
else if (queue->receivedParityPackets != 0 &&
|
else if (queue->receivedParityPackets != 0 &&
|
||||||
neededPackets - queue->pendingFecBlockList.count > U16(queue->bufferHighestSequenceNumber - queue->receivedParityHighestSequenceNumber)) {
|
neededPackets - queue->pendingFecBlockList.count > U16(queue->bufferHighestSequenceNumber - queue->receivedParityHighestSequenceNumber)) {
|
||||||
// If we've seen some parity shards but not enough parity shards remain to recover this frame
|
// If we've seen some parity shards but not enough parity shards remain to recover this frame
|
||||||
// without additional data shards, we will presume the frame is lost.
|
// without additional data shards, we will presume the frame is lost.
|
||||||
notifyFrameLost(queue->currentFrameNumber);
|
notifyFrameLost(queue->currentFrameNumber, true);
|
||||||
queue->reportedLostFrame = true;
|
queue->reportedLostFrame = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,7 +560,7 @@ int RtpvAddPacket(PRTP_VIDEO_QUEUE queue, PRTP_PACKET packet, int length, PRTPV_
|
|||||||
|
|
||||||
// Notify the host of the loss of this frame
|
// Notify the host of the loss of this frame
|
||||||
if (!queue->reportedLostFrame) {
|
if (!queue->reportedLostFrame) {
|
||||||
notifyFrameLost(queue->currentFrameNumber);
|
notifyFrameLost(queue->currentFrameNumber, false);
|
||||||
queue->reportedLostFrame = true;
|
queue->reportedLostFrame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ int RtpvAddPacket(PRTP_VIDEO_QUEUE queue, PRTP_PACKET packet, int length, PRTPV_
|
|||||||
|
|
||||||
// Notify the host of the loss of this frame
|
// Notify the host of the loss of this frame
|
||||||
if (!queue->reportedLostFrame) {
|
if (!queue->reportedLostFrame) {
|
||||||
notifyFrameLost(queue->currentFrameNumber);
|
notifyFrameLost(queue->currentFrameNumber, false);
|
||||||
queue->reportedLostFrame = true;
|
queue->reportedLostFrame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,7 +623,7 @@ int RtpvAddPacket(PRTP_VIDEO_QUEUE queue, PRTP_PACKET packet, int length, PRTPV_
|
|||||||
// NB: We only have to notify for the most recent lost frame, since
|
// NB: We only have to notify for the most recent lost frame, since
|
||||||
// the depacketizer will report the RFI range starting at the last
|
// the depacketizer will report the RFI range starting at the last
|
||||||
// frame it saw.
|
// frame it saw.
|
||||||
notifyFrameLost(nvPacket->frameIndex - 1);
|
notifyFrameLost(nvPacket->frameIndex - 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -893,7 +893,7 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length,
|
|||||||
// if it determines the frame to be unrecoverable. This lets us
|
// if it determines the frame to be unrecoverable. This lets us
|
||||||
// avoid having to wait until the next received frame to determine
|
// avoid having to wait until the next received frame to determine
|
||||||
// that we lost a frame and submit an RFI request.
|
// that we lost a frame and submit an RFI request.
|
||||||
void notifyFrameLost(unsigned int frameNumber) {
|
void notifyFrameLost(unsigned int frameNumber, bool speculative) {
|
||||||
// This may only be called at frame boundaries
|
// This may only be called at frame boundaries
|
||||||
LC_ASSERT(!decodingFrame);
|
LC_ASSERT(!decodingFrame);
|
||||||
|
|
||||||
@@ -902,7 +902,12 @@ void notifyFrameLost(unsigned int frameNumber) {
|
|||||||
|
|
||||||
// If RFI is enabled, we will notify the host PC now
|
// If RFI is enabled, we will notify the host PC now
|
||||||
if (isReferenceFrameInvalidationEnabled()) {
|
if (isReferenceFrameInvalidationEnabled()) {
|
||||||
|
if (speculative) {
|
||||||
Limelog("Sending speculative RFI request for predicted loss of frame %d\n", frameNumber);
|
Limelog("Sending speculative RFI request for predicted loss of frame %d\n", frameNumber);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Limelog("Sending RFI request for unrecoverable frame %d\n", frameNumber);
|
||||||
|
}
|
||||||
|
|
||||||
// Advance the frame number since we won't be expecting this one anymore
|
// Advance the frame number since we won't be expecting this one anymore
|
||||||
nextFrameNumber = frameNumber + 1;
|
nextFrameNumber = frameNumber + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user