From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3516941069 for ; Mon, 10 Jul 2023 19:09:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E375F68C547; Mon, 10 Jul 2023 22:09:02 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2C82568B104 for ; Mon, 10 Jul 2023 22:08:57 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id F1AEAE8BA9 for ; Mon, 10 Jul 2023 21:05:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IoEMoH2p6E1x for ; Mon, 10 Jul 2023 21:05:45 +0200 (CEST) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id C9D87E6C08 for ; Mon, 10 Jul 2023 21:05:45 +0200 (CEST) Date: Mon, 10 Jul 2023 21:05:45 +0200 (CEST) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <168899324473.27367.17259716301702650981@lain.khirnov.net> Message-ID: <32a95f49-e54e-8aaf-b1f-20ace7d9c1e8@passwd.hu> References: =?utf-8?q?=3CGV1P250MB0737CBAF57E68F4DD8CE0F9F8F33A=40GV1P250MB0?= =?utf-8?q?737=2EEURP250=2EPROD=2EOUTLOOK=2ECOM=3E?= <168899324473.27367.17259716301702650981@lain.khirnov.net> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 10 Jul 2023, Anton Khirnov wrote: > Quoting Andreas Rheinhardt (2023-07-10 01:36:41) >> Should fix #10457, a regression caused by >> 69516ab3e917a6e91d26e38d04183c60fd71cbab. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> 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. I don't think that 2x EAGAIN is allowed, the docs says: ... the only guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on one end implies that a receive/send call on the other end will succeed, or at least will not fail with AVERROR(EAGAIN). In general, no codec will permit unlimited buffering of input or output. Regards, Marton > > >> >> 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". > _______________________________________________ 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".