[FFmpeg-cvslog] fftools/ffmpeg_dec: abort if avcodec_send_packet() returns EAGAIN
James Almer
git at videolan.org
Sat May 27 01:47:43 EEST 2023
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon May 22 19:13:25 2023 -0300| [e86e2d5921a30b582619466f14f5274b1f986729] | committer: James Almer
fftools/ffmpeg_dec: abort if avcodec_send_packet() returns EAGAIN
As the comment in the code mentions, EAGAIN is not an expected value here
because we call avcodec_receive_frame() until all frames have been returned.
avcodec_send_packet() returning EAGAIN means a packet is still buffered, which
hints that the underlying decoder is buggy and not fetching packets as it
should.
An example of this behavior was in the libdav1d wrapper before f209614290,
where feeding it split frames (or individual OBUs) would result in the CLI
eventually printing the confusing "Error submitting packet to decoder: Resource
temporarily unavailable" error message, and just keep going until EOF without
returning new frames.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e86e2d5921a30b582619466f14f5274b1f986729
---
fftools/ffmpeg_dec.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index e06747d9c4..04b7db1e17 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -390,6 +390,11 @@ int dec_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
if (ret < 0 && !(ret == AVERROR_EOF && !pkt)) {
// In particular, we don't expect AVERROR(EAGAIN), because we read all
// decoded frames with avcodec_receive_frame() until done.
+ if (ret == AVERROR(EAGAIN)) {
+ av_log(ist, AV_LOG_FATAL, "A decoder returned an unexpected error code. "
+ "This is a bug, please report it.\n");
+ exit_program(1);
+ }
av_log(ist, AV_LOG_ERROR, "Error submitting %s to decoder: %s\n",
pkt ? "packet" : "EOF", av_err2str(ret));
if (exit_on_error)
More information about the ffmpeg-cvslog
mailing list