Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet
@ 2023-07-09 23:36 Andreas Rheinhardt
  2023-07-10 12:47 ` Anton Khirnov
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rheinhardt @ 2023-07-09 23:36 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-10 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-09 23:36 [FFmpeg-devel] [PATCH] avcodec/decode: Return EAGAIN instead of overwriting unused packet Andreas Rheinhardt
2023-07-10 12:47 ` Anton Khirnov
2023-07-10 14:25   ` Andreas Rheinhardt
2023-07-10 19:05   ` Marton Balint

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