mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 09:25:49 +00:00
Fix crash when using DR_NEEDS_IDR on a non-direct submit decoder
This commit is contained in:
parent
b528ef7921
commit
ed134f07d3
@ -14,6 +14,7 @@ static unsigned int lastPacketInStream;
|
|||||||
static int decodingFrame;
|
static int decodingFrame;
|
||||||
static int strictIdrFrameWait;
|
static int strictIdrFrameWait;
|
||||||
static unsigned long long firstPacketReceiveTime;
|
static unsigned long long firstPacketReceiveTime;
|
||||||
|
static int dropStatePending;
|
||||||
|
|
||||||
#define CONSECUTIVE_DROP_LIMIT 120
|
#define CONSECUTIVE_DROP_LIMIT 120
|
||||||
static unsigned int consecutiveFrameDrops;
|
static unsigned int consecutiveFrameDrops;
|
||||||
@ -39,6 +40,7 @@ void initializeVideoDepacketizer(int pktSize) {
|
|||||||
lastPacketInStream = UINT32_MAX;
|
lastPacketInStream = UINT32_MAX;
|
||||||
decodingFrame = 0;
|
decodingFrame = 0;
|
||||||
firstPacketReceiveTime = 0;
|
firstPacketReceiveTime = 0;
|
||||||
|
dropStatePending = 0;
|
||||||
strictIdrFrameWait = !isReferenceFrameInvalidationEnabled();
|
strictIdrFrameWait = !isReferenceFrameInvalidationEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,12 +411,17 @@ void requestDecoderRefresh(void) {
|
|||||||
// Wait for the next IDR frame
|
// Wait for the next IDR frame
|
||||||
waitingForIdrFrame = 1;
|
waitingForIdrFrame = 1;
|
||||||
|
|
||||||
// Flush the decode unit queue and pending state
|
// Flush the decode unit queue
|
||||||
dropFrameState();
|
|
||||||
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||||
freeDecodeUnitList(LbqFlushQueueItems(&decodeUnitQueue));
|
freeDecodeUnitList(LbqFlushQueueItems(&decodeUnitQueue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request the receive thread drop its state
|
||||||
|
// on the next call. We can't do it here because
|
||||||
|
// it may be trying to queue DUs and we'll nuke
|
||||||
|
// the state out from under it.
|
||||||
|
dropStatePending = 1;
|
||||||
|
|
||||||
// Request the IDR frame
|
// Request the IDR frame
|
||||||
requestIdrOnDemand();
|
requestIdrOnDemand();
|
||||||
}
|
}
|
||||||
@ -442,6 +449,13 @@ void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, unsigned long l
|
|||||||
unsigned int firstPacket;
|
unsigned int firstPacket;
|
||||||
unsigned int streamPacketIndex;
|
unsigned int streamPacketIndex;
|
||||||
|
|
||||||
|
// Before processing this packet at all, drop depacketizer
|
||||||
|
// state if the decoder asked for it.
|
||||||
|
if (dropStatePending) {
|
||||||
|
dropStatePending = 0;
|
||||||
|
dropFrameState();
|
||||||
|
}
|
||||||
|
|
||||||
// Mask the top 8 bits from the SPI
|
// Mask the top 8 bits from the SPI
|
||||||
videoPacket->streamPacketIndex >>= 8;
|
videoPacket->streamPacketIndex >>= 8;
|
||||||
videoPacket->streamPacketIndex &= 0xFFFFFF;
|
videoPacket->streamPacketIndex &= 0xFFFFFF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user