Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint <cus@passwd.hu>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet
Date: Mon, 10 Jul 2023 21:05:45 +0200 (CEST)
Message-ID: <32a95f49-e54e-8aaf-b1f-20ace7d9c1e8@passwd.hu> (raw)
In-Reply-To: <168899324473.27367.17259716301702650981@lain.khirnov.net>



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 <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.

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".

      parent reply	other threads:[~2023-07-10 19:09 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
2023-07-10 14:25   ` Andreas Rheinhardt
2023-07-10 19:05   ` Marton Balint [this message]

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=32a95f49-e54e-8aaf-b1f-20ace7d9c1e8@passwd.hu \
    --to=cus@passwd.hu \
    --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