[FFmpeg-devel,1/2] ffmpeg: log corrupted packets and frames

Submitted by Marton Balint on Oct. 9, 2018, 11:32 p.m.

Details

Message ID 20181009233214.8785-1-cus@passwd.hu
State Accepted
Commit f099946fafb8f4b1beb40b680599ccce96263ccd
Headers show

Commit Message

Marton Balint Oct. 9, 2018, 11:32 p.m.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 fftools/ffmpeg.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer Oct. 11, 2018, 9:56 a.m.
On Wed, Oct 10, 2018 at 01:32:13AM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  fftools/ffmpeg.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)

maybe this should also print some time information so the user knows from
the printout when issues occured
but LGTM otherwise

thanks

[...]
Marton Balint Oct. 14, 2018, 10:54 p.m.
On Thu, 11 Oct 2018, Michael Niedermayer wrote:

> On Wed, Oct 10, 2018 at 01:32:13AM +0200, Marton Balint wrote:
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  fftools/ffmpeg.c | 16 ++++++++++------
>>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> maybe this should also print some time information so the user knows from
> the printout when issues occured
> but LGTM otherwise

Thanks pushed. Will send a separate patch with some additional time 
information.

Regards,
Marton

Patch hide | download patch | download mbox

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index aa495b5d9e..da4259a9a8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2110,10 +2110,12 @@  static void check_decode_result(InputStream *ist, int *got_output, int ret)
     if (ret < 0 && exit_on_error)
         exit_program(1);
 
-    if (exit_on_error && *got_output && ist) {
+    if (*got_output && ist) {
         if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
-            av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->url, ist->st->index);
-            exit_program(1);
+            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);
+            if (exit_on_error)
+                exit_program(1);
         }
     }
 }
@@ -4350,9 +4352,11 @@  static int process_input(int file_index)
     if (ist->discard)
         goto discard_packet;
 
-    if (exit_on_error && (pkt.flags & AV_PKT_FLAG_CORRUPT)) {
-        av_log(NULL, AV_LOG_FATAL, "%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index);
-        exit_program(1);
+    if (pkt.flags & AV_PKT_FLAG_CORRUPT) {
+        av_log(NULL, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING,
+               "%s: corrupt input packet in stream %d\n", is->url, pkt.stream_index);
+        if (exit_on_error)
+            exit_program(1);
     }
 
     if (debug_ts) {