The branch, master has been updated
via 9e3c07f2dfaaf55690a83b173778487ce5c9a484 (commit)
via 0773343ed769d4b14d58803cf2957223f93e1b4f (commit)
from 6e63b978d32ea3449a7dbb47e9eb7c8ad00af30d (commit)
- Log -----------------------------------------------------------------
commit 9e3c07f2dfaaf55690a83b173778487ce5c9a484
Author: Zhao Zhili <[email protected]>
AuthorDate: Sat Sep 13 13:31:17 2025 +0800
Commit: Zhao Zhili <[email protected]>
CommitDate: Sun Sep 14 21:35:54 2025 +0800
avcodec/rkmppdec: fix return EAGAIN during flushing
Signed-off-by: Zhao Zhili <[email protected]>
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index 62ba51cff8..a6bc565776 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -519,11 +519,15 @@ static int rkmpp_receive_frame(AVCodecContext *avctx,
AVFrame *frame)
}
// make sure we keep decoder full
- if (freeslots > 1)
+ if (freeslots > 1 && !decoder->eos_reached)
return AVERROR(EAGAIN);
}
- return rkmpp_retrieve_frame(avctx, frame);
+ do {
+ ret = rkmpp_retrieve_frame(avctx, frame);
+ } while (decoder->eos_reached && ret == AVERROR(EAGAIN));
+
+ return ret;
}
static av_cold void rkmpp_flush(AVCodecContext *avctx)
commit 0773343ed769d4b14d58803cf2957223f93e1b4f
Author: Zhao Zhili <[email protected]>
AuthorDate: Sat Sep 13 12:26:08 2025 +0800
Commit: Zhao Zhili <[email protected]>
CommitDate: Sun Sep 14 21:35:54 2025 +0800
avcodec/rkmppdec: fix input queue overflow
The strategy to count free slots isn't reliable. The value of
INPUT_MAX_PACKETS is a hardcoded value, and MPP_DEC_GET_STREAM_COUNT
doesn't always work as expected. When freeslots is nonzero, the mpp
decoder still returns MPP_ERR_BUFFER_FULL. Before this patch, all
packets are dropped once went into MPP_ERR_BUFFER_FULL state.
Don't drop packet and return error in MPP_ERR_BUFFER_FULL state.
Receive frame to allow the decoder's state machine to resume.
Signed-off-by: Zhao Zhili <[email protected]>
diff --git a/libavcodec/rkmppdec.c b/libavcodec/rkmppdec.c
index a5ed0fc9b7..62ba51cff8 100644
--- a/libavcodec/rkmppdec.c
+++ b/libavcodec/rkmppdec.c
@@ -484,7 +484,6 @@ static int rkmpp_receive_frame(AVCodecContext *avctx,
AVFrame *frame)
RKMPPDecodeContext *rk_context = avctx->priv_data;
RKMPPDecoder *decoder = rk_context->decoder;
int ret = MPP_NOK;
- AVPacket pkt = {0};
RK_S32 usedslots, freeslots;
if (!decoder->eos_reached) {
@@ -497,17 +496,25 @@ static int rkmpp_receive_frame(AVCodecContext *avctx,
AVFrame *frame)
freeslots = INPUT_MAX_PACKETS - usedslots;
if (freeslots > 0) {
- ret = ff_decode_get_packet(avctx, &pkt);
- if (ret < 0 && ret != AVERROR_EOF) {
- return ret;
- }
+ AVPacket *const pkt = avctx->internal->in_pkt;
- ret = rkmpp_send_packet(avctx, &pkt);
- av_packet_unref(&pkt);
+ if (!pkt->size) {
+ ret = ff_decode_get_packet(avctx, pkt);
+ if (ret < 0 && ret != AVERROR_EOF) {
+ return ret;
+ }
+ }
- if (ret < 0) {
+ ret = rkmpp_send_packet(avctx, pkt);
+ if (ret < 0 && ret != AVERROR(EAGAIN)) {
+ av_packet_unref(pkt);
av_log(avctx, AV_LOG_ERROR, "Failed to send packet to decoder
(code = %d)\n", ret);
return ret;
+ } else if (ret == AVERROR(EAGAIN)) {
+ // Input queue is full, don't queue more packet.
+ freeslots = 0;
+ } else {
+ av_packet_unref(pkt);
}
}
-----------------------------------------------------------------------
Summary of changes:
libavcodec/rkmppdec.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]