[FFmpeg-devel] EOF and IO error checking

James Almer jamrial at gmail.com
Thu Aug 22 17:38:19 EEST 2019


On 8/17/2019 4:10 PM, Marton Balint wrote:
> Hi,
> 
> As you might now avio_feof() returns true both in case of actual EOF and
> in case of IO errors.
> 
> Some demuxers (matroska) have special handling for this exact reason, e.g.:
> 
> if (avio_feof(pb)) {
>     if (pb->error) {
>         return pb->error;
>     } else {
>         return AVERROR_EOF;
>     }
> }
> 
> Most of the demuxers do not, so there is a real chance that IO errrors
> are mistaken for EOF.
> 
> What should we do about this?
> 
> a) Fix every demuxer to return IO error if there is one.
> 
> b) Add special code to ff_read_packet which checks if there is an error
> in the IO context and return that if there is?

Handling things in generic code is preferred over adding checks to every
demuxer, IMO.

Also, fixes in libavformat are always preferred over fixes/workarounds
in ffmpeg.c, since the latter will not have any effect on every other
library user.

> 
> c) Add code to ffmpeg.c which checks the IO context error code after
> every av_read_frame call?
> 
> Some other idea? Which one is preferred from these?
> 
> Thanks,
> Marton
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list