Message ID | 20240409130509.1461-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 9dbc9a0f9755e769793975278570b7eb6c8870e4 |
Headers | show |
Series | [FFmpeg-devel] avcodec/libsvt1: check return value of sned/receive functions | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Hi James, On Tue, Apr 9, 2024, 09:05 James Almer <jamrial@gmail.com> wrote: > 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". > Commit title is mis-spelled: sned -> send. Other than that, looks OK. -- Sean McGovern >
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) {
Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/libsvtav1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)