[FFmpeg-devel] [PATCH 4/5] ffmpeg: exit on corrupt packets or decoded frames if exit_on_error flag is present

Michael Niedermayer michael at niedermayer.cc
Mon Oct 19 00:43:55 CEST 2015


On Sun, Oct 18, 2015 at 12:24:06AM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  ffmpeg.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 3a36af7..f6947f8 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1925,13 +1925,20 @@ int guess_input_channel_layout(InputStream *ist)
>      return 1;
>  }
>  
> -static void check_decode_result(int *got_output, int ret)
> +static void check_decode_result(int *got_output, int ret, AVFrame *frame)
>  {
>      if (*got_output || ret<0)
>          decode_error_stat[ret<0] ++;
>  
>      if (ret < 0 && exit_on_error)
>          exit_program(1);
> +
> +    if (exit_on_error && *got_output && frame) {
> +        if (av_frame_get_decode_error_flags(frame) || (frame->flags & AV_FRAME_FLAG_CORRUPT)) {
> +            av_log(NULL, AV_LOG_FATAL, "Corrupt decoded frame\n");

this too should give some indication of which stream/filename was
failing unless something else already prints that information

[...]
> @@ -3770,6 +3777,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, "Corrupt input packet\n");

same suggestion

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151019/63d92b1f/attachment.sig>


More information about the ffmpeg-devel mailing list