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/libsvt1: check return value of sned/receive functions
@ 2024-04-09 13:05 James Almer
  2024-04-09 16:34 ` Sean McGovern
  0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2024-04-09 13:05 UTC (permalink / raw)
  To: ffmpeg-devel

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

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

* Re: [FFmpeg-devel] [PATCH] avcodec/libsvt1: check return value of sned/receive functions
  2024-04-09 13:05 [FFmpeg-devel] [PATCH] avcodec/libsvt1: check return value of sned/receive functions James Almer
@ 2024-04-09 16:34 ` Sean McGovern
  0 siblings, 0 replies; 2+ messages in thread
From: Sean McGovern @ 2024-04-09 16:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

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

>
_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2024-04-09 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 13:05 [FFmpeg-devel] [PATCH] avcodec/libsvt1: check return value of sned/receive functions James Almer
2024-04-09 16:34 ` Sean McGovern

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