[FFmpeg-devel] [PATCH 2/3] ffmpeg: warn users about demuxers producing zero sized packets

wm4 nfxjfg at googlemail.com
Fri Sep 30 12:43:35 EEST 2016


On Fri, 30 Sep 2016 11:29:06 +0200
Marton Balint <cus at passwd.hu> wrote:

> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  ffmpeg.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 9a8e65a..2296df8 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -3865,10 +3865,19 @@ static int process_input(int file_index)
>      int ret, i, j;
>      int64_t duration;
>      int64_t pkt_dts;
> +    static int warned_zero_sized_packet_bug = 0;
>  
>      is  = ifile->ctx;
>      ret = get_input_packet(ifile, &pkt);
>  
> +    if (ret >= 0 && pkt.size == 0) {
> +        if (!warned_zero_sized_packet_bug) {
> +            av_log(is, AV_LOG_ERROR, "Demuxer is generating zero sized packets, report this bug!\n");
> +            warned_zero_sized_packet_bug = 1;
> +        }
> +        ret = AVERROR(EAGAIN);
> +    }
> +
>      if (ret == AVERROR(EAGAIN)) {
>          ifile->eagain = 1;
>          return ret;

Also fine with me. I think there are a bunch of situations where
demuxers still do this, and they should all be gradually fixed.

Should this be in libavformat?


More information about the ffmpeg-devel mailing list