[FFmpeg-devel] [PATCH] avformat/utils: return pending IO error on EOF in av_read_frame()

Nicolas George george at nsup.org
Thu Aug 29 23:01:08 EEST 2019


Marton Balint (12019-08-24):
> avio_feof() returns true both in case of actual EOF and in case of IO errors.
> Some demuxers (matroska) have special handling to be able to return the proper
> error for this exact reason, e.g.:
> 
> if (avio_feof(pb)) {
>      if (pb->error) {
>          return pb->error;
>      } else {
>          return AVERROR_EOF;
>      }
> }
> 
> However, most of the demuxers do not, and they simply return AVERROR_EOF if
> avio_feof() is true, so there is a real chance that IO errors are mistaken for
> EOF.
> 
> We might just say that the API user should always check the IO context error
> attribute on EOF to make sure no IO errors happened, but not even ffmpeg.c does
> this. It should be more intuitive to the API user if we simply return the IO
> error as the return value of av_read_frame() instead of AVERROR_EOF.

I am not very happy with this. It might be a short-term mitigation of
the problem, but the real issue is that demuxers do not correctly do
their error checking, ant that needs to be fixed.

I am not opposing this patch, but I think it is important to keep that
in mind.

Regards,

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


More information about the ffmpeg-devel mailing list