mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 06:11:03 +00:00
When a decoder requests an IDR frame, don't submit another frame until the IDR frame arrives
This commit is contained in:
@@ -40,6 +40,7 @@ void destroyVideoDepacketizer(void);
|
|||||||
void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length);
|
void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length);
|
||||||
void queueRtpPacket(PRTP_PACKET rtpPacket, int length);
|
void queueRtpPacket(PRTP_PACKET rtpPacket, int length);
|
||||||
void stopVideoDepacketizer(void);
|
void stopVideoDepacketizer(void);
|
||||||
|
void requestDecoderRefresh(void);
|
||||||
|
|
||||||
void initializeVideoStream(void);
|
void initializeVideoStream(void);
|
||||||
void destroyVideoStream(void);
|
void destroyVideoStream(void);
|
||||||
|
|||||||
@@ -225,8 +225,8 @@ static void reassembleAvcFrame(int frameNumber) {
|
|||||||
freeQueuedDecodeUnit(qdu);
|
freeQueuedDecodeUnit(qdu);
|
||||||
|
|
||||||
if (ret == DR_NEED_IDR) {
|
if (ret == DR_NEED_IDR) {
|
||||||
Limelog("Request IDR frame on behalf of DR\n");
|
Limelog("Requesting IDR frame on behalf of DR\n");
|
||||||
requestIdrOnDemand();
|
requestDecoderRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,6 +330,22 @@ static void processRtpPayloadSlow(PNV_VIDEO_PACKET videoPacket, PBUFFER_DESC cur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dumps the decode unit queue and ensures the next frame submitted to the decoder will be
|
||||||
|
// an IDR frame
|
||||||
|
void requestDecoderRefresh(void) {
|
||||||
|
// Wait for the next IDR frame
|
||||||
|
waitingForIdrFrame = 1;
|
||||||
|
|
||||||
|
// Flush the decode unit queue and pending state
|
||||||
|
dropAvcFrameState();
|
||||||
|
if ((VideoCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||||
|
freeDecodeUnitList(LbqFlushQueueItems(&decodeUnitQueue));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request the IDR frame
|
||||||
|
requestIdrOnDemand();
|
||||||
|
}
|
||||||
|
|
||||||
// Return 1 if packet is the first one in the frame
|
// Return 1 if packet is the first one in the frame
|
||||||
static int isFirstPacket(char flags) {
|
static int isFirstPacket(char flags) {
|
||||||
// Clear the picture data flag
|
// Clear the picture data flag
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ static void DecoderThreadProc(void* context) {
|
|||||||
|
|
||||||
if (ret == DR_NEED_IDR) {
|
if (ret == DR_NEED_IDR) {
|
||||||
Limelog("Requesting IDR frame on behalf of DR\n");
|
Limelog("Requesting IDR frame on behalf of DR\n");
|
||||||
requestIdrOnDemand();
|
requestDecoderRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user