avcodec/lcevcdec: move lcevc_flush_pictures() before lcevc_send_frame()

This commit is contained in:
Michael Niedermayer authored and michaelni committed 2026-10-28 21:08:03 +00:00
1 parent 9e80af4e59
commit 902df73ba8
1 file changed
+25 -25
+25 -25
View File
@@ -145,6 +145,31 @@ static int alloc_enhanced_frame(FFLCEVCFrame *frame_ctx,
return 0;
}
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
{
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
while (1) {
AVFrame *base = NULL;
res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
if (res != LCEVC_Success && res != LCEVC_Again)
return AVERROR_EXTERNAL;
if (res == LCEVC_Again)
break;
LCEVC_GetPictureUserData(lcevc->decoder, picture, (void **)&base);
av_frame_free(&base);
res = LCEVC_FreePicture(lcevc->decoder, picture);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
}
return 0;
}
static int lcevc_send_frame(FFLCEVCFrame *frame_ctx, const AVFrame *in)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;
@@ -270,31 +295,6 @@ static int generate_output(FFLCEVCFrame *frame_ctx, AVFrame *out)
return 0;
}
static int lcevc_flush_pictures(FFLCEVCContext *lcevc)
{
LCEVC_PictureHandle picture;
LCEVC_ReturnCode res;
while (1) {
AVFrame *base = NULL;
res = LCEVC_ReceiveDecoderBase (lcevc->decoder, &picture);
if (res != LCEVC_Success && res != LCEVC_Again)
return AVERROR_EXTERNAL;
if (res == LCEVC_Again)
break;
LCEVC_GetPictureUserData(lcevc->decoder, picture, (void **)&base);
av_frame_free(&base);
res = LCEVC_FreePicture(lcevc->decoder, picture);
if (res != LCEVC_Success)
return AVERROR_EXTERNAL;
}
return 0;
}
static int lcevc_receive_frame(FFLCEVCFrame *frame_ctx, AVFrame *out)
{
FFLCEVCContext *lcevc = frame_ctx->lcevc;