From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet Date: Mon, 10 Jul 2023 01:36:41 +0200 Message-ID: <GV1P250MB0737CBAF57E68F4DD8CE0F9F8F33A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw) Should fix #10457, a regression caused by 69516ab3e917a6e91d26e38d04183c60fd71cbab. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- I am not sure about this one. The problem is that avcodec_send_packet() and avcodec_receive_frame() must not return EAGAIN at the same time. If buffer_frame contains a frame when entering avcodec_send_packet(), the next call to avcodec_receive_frame() will not return EAGAIN. But is this actually guaranteed if buffer_pkt is not empty? libavcodec/decode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 269633ce10..6595c3ca34 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -666,6 +666,9 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke if (avpkt && !avpkt->size && avpkt->data) return AVERROR(EINVAL); + if (!AVPACKET_IS_EMPTY(avci->buffer_pkt)) + return AVERROR(EAGAIN); + av_packet_unref(avci->buffer_pkt); if (avpkt && (avpkt->data || avpkt->side_data_elems)) { ret = av_packet_ref(avci->buffer_pkt, avpkt); -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2023-07-09 23:35 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-09 23:36 Andreas Rheinhardt [this message] 2023-07-10 12:47 ` Anton Khirnov 2023-07-10 14:25 ` Andreas Rheinhardt 2023-07-10 19:05 ` Marton Balint
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=GV1P250MB0737CBAF57E68F4DD8CE0F9F8F33A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git