From c86e0537d11566f9825d6323711ec61e3e702365 Mon Sep 17 00:00:00 2001 From: camelcx <81581919+camelcx@users.noreply.github.com> Date: Sun, 6 Jul 2025 01:13:06 +0100 Subject: [PATCH] Fix some edge case on small MTU devices using qsv codec (#107) Add fall back logic to prevent edge case where SPS SPP is not included in the same packet and key IDR frame is mislabeled as P frame causing assertion error at validation. --- src/VideoDepacketizer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/VideoDepacketizer.c b/src/VideoDepacketizer.c index 33faf73..b5321c1 100644 --- a/src/VideoDepacketizer.c +++ b/src/VideoDepacketizer.c @@ -495,10 +495,14 @@ static void reassembleFrame(int frameNumber) { qdu->decodeUnit.colorspace = (uint8_t)(qdu->decodeUnit.hdrActive ? COLORSPACE_REC_2020 : StreamConfig.colorSpace); // Invoke the key frame callback if needed - if (qdu->decodeUnit.frameType == FRAME_TYPE_IDR) { + if (nalChainHead->bufferType != BUFFER_TYPE_PICDATA || qdu->decodeUnit.frameType == FRAME_TYPE_IDR) { + qdu->decodeUnit.frameType = FRAME_TYPE_IDR; notifyKeyFrameReceived(); } - + else { + qdu->decodeUnit.frameType = FRAME_TYPE_PFRAME; + } + nalChainHead = nalChainTail = NULL; nalChainDataLength = 0;