[FFmpeg-devel] [PATCH 2/3] lavf/avio: temporarily accept 0 as EOF.

Jan Ekstrom jeebjp at gmail.com
Fri Oct 27 20:57:25 EEST 2017


On Wed, Oct 25, 2017 at 11:22 AM, Nicolas George <george at nsup.org> wrote:
> +static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size)
> +{
> +    int ret;
> +
> +    if (!s->read_packet)
> +        return AVERROR_EOF;
> +    ret = s->read_packet(s->opaque, buf, size);
> +#if FF_API_OLD_AVIO_EOF_0
> +    if (!ret && !s->max_packet_size) {
> +        av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n");
> +        ret = AVERROR_EOF;
> +    }
> +#else
> +    av_assert2(ret || s->max_packet_size);
> +#endif
> +    return ret;
> +}
> +

Built and tested locally and the effect seems to be the one wished,
although it seems like it is complaining about the AVClass being
nullptr? Is this something inherent to custom AVIO contexts and it's
the client that's supposed to fix this? Log follows:

> [ffmpeg] av_log callback called with bad parameters (NULL AVClass).
> [ffmpeg] This is a bug in one of Libav/FFmpeg libraries used.
> [ffmpeg] Invalid return value 0 for stream protocol


Jan


More information about the ffmpeg-devel mailing list