[FFmpeg-devel] [PATCH] ffmpeg: do not mark outputs as finished unless AVERROR_EOF

Nicolas George george at nsup.org
Sun Nov 22 23:50:04 CET 2015


Le duodi 2 frimaire, an CCXXIV, Mort Yao a écrit :
> Whenever an error occurred in get_input_packet(), process_input() used to
> attempt to mark all outputs that didn't go through lavfi as finished. However,
> for a concat demuxer, doing so might drop the rest of input streams (in case of
> an error such like EINVAL returned by av_read_frame()) and produce incomplete
> outputs unexpectedly. This patch shall allow for only finishing outputs when
> end-of-file encountered, by checking whether the return code is AVERROR_EOF.

I do not think this is acceptable as default behaviour. Some (most?) errors
will persist: not marking the stream finished will let ffmpeg try over and
over again to read a packet from the same place in the same file.

It could be a per-stream or per-file option, though.

> -        for (i = 0; i < ifile->nb_streams; i++) {
> -            ist = input_streams[ifile->ist_index + i];
> -            if (ist->decoding_needed) {
> -                ret = process_input_packet(ist, NULL, 0);
> -                if (ret>0)
> -                    return 0;
> -            }
> +        } else {
> +            for (i = 0; i < ifile->nb_streams; i++) {
> +                ist = input_streams[ifile->ist_index + i];
> +                if (ist->decoding_needed) {
> +                    ret = process_input_packet(ist, NULL, 0);
> +                    if (ret>0)
> +                        return 0;

In the future, please remember to reindent blocks of lines in a separate
patch, that makes the functional patch much easier to check.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151122/833cf0fe/attachment.sig>


More information about the ffmpeg-devel mailing list