From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet
Date: Mon, 10 Jul 2023 14:47:24 +0200
Message-ID: <168899324473.27367.17259716301702650981@lain.khirnov.net> (raw)
In-Reply-To: =?utf-8?q?=3CGV1P250MB0737CBAF57E68F4DD8CE0F9F8F33A=40GV1P250MB?= =?utf-8?q?0737=2EEURP250=2EPROD=2EOUTLOOK=2ECOM=3E?=
Quoting Andreas Rheinhardt (2023-07-10 01:36:41)
> 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?
It's not guaranteed, but I believe the correct interpretation of the
"must not return EAGAIN at the same time" line is that
send->receive->send must make progress and not be 3x EAGAIN.
>
> 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);
This unref here becomes redundant.
Otherwise looks good, thanks.
--
Anton Khirnov
_______________________________________________
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 prev reply other threads:[~2023-07-10 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-09 23:36 Andreas Rheinhardt
2023-07-10 12:47 ` Anton Khirnov [this message]
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=168899324473.27367.17259716301702650981@lain.khirnov.net \
--to=anton@khirnov.net \
--cc=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