diff mbox

[FFmpeg-devel] ffmpeg: Improve warnings if av_buffersrc_add_frame*() fail

Message ID CAB0OVGpBHs+rcJ52cpK4sU3b8N_bBV3YVaXocbCfxufnhkjVUw@mail.gmail.com
State New
Headers show

Commit Message

Carl Eugen Hoyos Nov. 23, 2017, 11:09 a.m. UTC
Hi!

Attached patch implements more verbose warnings as suggested by Nicolas.

Please comment, Carl Eugen

Comments

Derek Buitenhuis Nov. 23, 2017, 2:11 p.m. UTC | #1
On 11/23/2017 11:09 AM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch implements more verbose warnings as suggested by Nicolas.
> 
> Please comment, Carl Eugen

OK.

- Derek
Nicolas George Nov. 23, 2017, 3:32 p.m. UTC | #2
Carl Eugen Hoyos (2017-11-23):
> Hi!
> 
> Attached patch implements more verbose warnings as suggested by Nicolas.
> 
> Please comment, Carl Eugen

> From 5ec3b8bdb776d9c14127017cd9e3077503be2bea Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Thu, 23 Nov 2017 12:05:51 +0100
> Subject: [PATCH] ffmpeg: Improve warnings if av_buffersrc_add_frame*() fail.
> 
> Suggested-by: Nicolas
> ---
>  fftools/ffmpeg.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 0c16e75..3ce8833 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -229,7 +229,8 @@ static void sub2video_push_ref(InputStream *ist, int64_t pts)
>                                             AV_BUFFERSRC_FLAG_KEEP_REF |
>                                             AV_BUFFERSRC_FLAG_PUSH);
>          if (ret != AVERROR_EOF && ret < 0)
> -            av_log(NULL, AV_LOG_WARNING, "Error while add the frame to buffer source(%s).\n",
> +            av_log(ist->filters[i]->filter, AV_LOG_WARNING,
> +                   "Failed to add a subtitle video frame to the buffer source: %s\n",

This part LGTM. But "buffer source" is not meant for end-users. "... to
the filter graph"?

>                     av_err2str(ret));
>      }
>  }
> @@ -307,7 +308,9 @@ static void sub2video_flush(InputStream *ist)
>      for (i = 0; i < ist->nb_filters; i++) {
>          ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
>          if (ret != AVERROR_EOF && ret < 0)

> -            av_log(NULL, AV_LOG_WARNING, "Flush the frame error.\n");
> +            av_log(ist->filters[i]->filter, AV_LOG_WARNING,
> +                   "Failed to add a subtitle video frame to the buffer source: %s\n",
> +                   av_err2str(ret));

This one looks wrong: there is no frame added, the error message you
remove is more accurate.

>      }
>  }
>  

Sorry to have been unresponsive on this issues the last few days.

Regards,
diff mbox

Patch

From 5ec3b8bdb776d9c14127017cd9e3077503be2bea Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Thu, 23 Nov 2017 12:05:51 +0100
Subject: [PATCH] ffmpeg: Improve warnings if av_buffersrc_add_frame*() fail.

Suggested-by: Nicolas
---
 fftools/ffmpeg.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0c16e75..3ce8833 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -229,7 +229,8 @@  static void sub2video_push_ref(InputStream *ist, int64_t pts)
                                            AV_BUFFERSRC_FLAG_KEEP_REF |
                                            AV_BUFFERSRC_FLAG_PUSH);
         if (ret != AVERROR_EOF && ret < 0)
-            av_log(NULL, AV_LOG_WARNING, "Error while add the frame to buffer source(%s).\n",
+            av_log(ist->filters[i]->filter, AV_LOG_WARNING,
+                   "Failed to add a subtitle video frame to the buffer source: %s\n",
                    av_err2str(ret));
     }
 }
@@ -307,7 +308,9 @@  static void sub2video_flush(InputStream *ist)
     for (i = 0; i < ist->nb_filters; i++) {
         ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
         if (ret != AVERROR_EOF && ret < 0)
-            av_log(NULL, AV_LOG_WARNING, "Flush the frame error.\n");
+            av_log(ist->filters[i]->filter, AV_LOG_WARNING,
+                   "Failed to add a subtitle video frame to the buffer source: %s\n",
+                   av_err2str(ret));
     }
 }
 
-- 
1.7.10.4