From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] avcodec/libsvt1: check return value of sned/receive functions
Date: Tue, 9 Apr 2024 10:05:09 -0300
Message-ID: <20240409130509.1461-1-jamrial@gmail.com> (raw)
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/libsvtav1.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 105c3369c0..6ff893cf10 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -486,6 +486,7 @@ static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
{
SvtContext *svt_enc = avctx->priv_data;
EbBufferHeaderType *headerPtr = svt_enc->in_buf;
+ EbErrorType svt_ret;
int ret;
if (!frame) {
@@ -524,7 +525,9 @@ static int eb_send_frame(AVCodecContext *avctx, const AVFrame *frame)
if (avctx->gop_size == 1)
headerPtr->pic_type = EB_AV1_KEY_PICTURE;
- svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
+ svt_ret = svt_av1_enc_send_picture(svt_enc->svt_handle, headerPtr);
+ if (svt_ret != EB_ErrorNone)
+ return svt_print_error(avctx, svt_ret, "Error sending a frame to encoder");
return 0;
}
@@ -579,6 +582,8 @@ static int eb_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
svt_ret = svt_av1_enc_get_packet(svt_enc->svt_handle, &headerPtr, svt_enc->eos_flag);
if (svt_ret == EB_NoErrorEmptyQueue)
return AVERROR(EAGAIN);
+ else if (svt_ret != EB_ErrorNone)
+ return svt_print_error(avctx, svt_ret, "Error getting an output packet from encoder");
#if SVT_AV1_CHECK_VERSION(2, 0, 0)
if (headerPtr->flags & EB_BUFFERFLAG_EOS) {
--
2.44.0
_______________________________________________
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 reply other threads:[~2024-04-09 13:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 13:05 James Almer [this message]
2024-04-09 16:34 ` Sean McGovern
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=20240409130509.1461-1-jamrial@gmail.com \
--to=jamrial@gmail.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