mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
When a decoder requests an IDR frame, don't submit another frame until the IDR frame arrives
This commit is contained in:
parent
8cced32917
commit
a8d98284a7
@ -40,6 +40,7 @@ void destroyVideoDepacketizer(void);
|
||||
void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length);
|
||||
void queueRtpPacket(PRTP_PACKET rtpPacket, int length);
|
||||
void stopVideoDepacketizer(void);
|
||||
void requestDecoderRefresh(void);
|
||||
|
||||
void initializeVideoStream(void);
|
||||
void destroyVideoStream(void);
|
||||
|
@ -225,8 +225,8 @@ static void reassembleAvcFrame(int frameNumber) {
|
||||
freeQueuedDecodeUnit(qdu);
|
||||
|
||||
if (ret == DR_NEED_IDR) {
|
||||
Limelog("Request IDR frame on behalf of DR\n");
|
||||
requestIdrOnDemand();
|
||||
Limelog("Requesting IDR frame on behalf of DR\n");
|
||||
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
|
||||
static int isFirstPacket(char flags) {
|
||||
// Clear the picture data flag
|
||||
|
@ -136,7 +136,7 @@ static void DecoderThreadProc(void* context) {
|
||||
|
||||
if (ret == DR_NEED_IDR) {
|
||||
Limelog("Requesting IDR frame on behalf of DR\n");
|
||||
requestIdrOnDemand();
|
||||
requestDecoderRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user