diff mbox

[FFmpeg-devel] Display decoded frame number on error

Message ID 20190712074530.86580-1-remi.achard@ymagis.com
State Superseded
Headers show

Commit Message

Rémi Achard July 12, 2019, 7:45 a.m. UTC
---
 fftools/ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gyan Doshi July 12, 2019, 8:25 a.m. UTC | #1
On 12-07-2019 01:15 PM, Rémi Achard wrote:
> ---
>   fftools/ffmpeg.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 01f04103cf..fe067007ea 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2107,7 +2107,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret)
>       if (*got_output && ist) {
>           if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
>               av_log(NULL, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
> -                   "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
> +                   "%s: corrupt decoded frame %llu in stream %d\n", input_files[ist->file_index]->ctx->url, ist->frames_decoded, ist->st->index);
>               if (exit_on_error)
>                   exit_program(1);
>           }

ist->frames_decoded is incremented after the call to this function, and 
in between, the fn returns if decode returned an error, so 
ist->frames_decoded shows the number of successfully decoded frames at 
the point of the result check and not the count of total packets/frames 
sent for decoding upto that point. Is that the intention?

Gyan
Rémi Achard July 12, 2019, 9:17 a.m. UTC | #2
Good point, thanks for the review, I updated the patch to display the
incremented frame number as suggested.
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 01f04103cf..fe067007ea 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2107,7 +2107,7 @@  static void check_decode_result(InputStream *ist, int *got_output, int ret)
     if (*got_output && ist) {
         if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
             av_log(NULL, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
-                   "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
+                   "%s: corrupt decoded frame %llu in stream %d\n", input_files[ist->file_index]->ctx->url, ist->frames_decoded, ist->st->index);
             if (exit_on_error)
                 exit_program(1);
         }