[FFmpeg-cvslog] avcodec/libsvt1: check return value of send/receive functions
James Almer
git at videolan.org
Wed Apr 10 03:40:21 EEST 2024
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Apr 9 10:05:09 2024 -0300| [9dbc9a0f9755e769793975278570b7eb6c8870e4] | committer: James Almer
avcodec/libsvt1: check return value of send/receive functions
Reviewed-by: Sean McGovern <gseanmcg at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9dbc9a0f9755e769793975278570b7eb6c8870e4
---
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) {
More information about the ffmpeg-cvslog
mailing list