[FFmpeg-devel] [PATCH] avformat/matroskadec: return AVERROR(EIO) rather than AVERROR_EOF on parse error
Nicolas George
george at nsup.org
Sat Jul 23 11:50:40 EEST 2016
Le quintidi 5 thermidor, an CCXXIV, Sophia Wang a écrit :
> Signed-off-by: Sophia Wang <skw at google.com>
> ---
> libavformat/matroskadec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index f3d701f..c536605 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -3323,7 +3323,7 @@ static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
> while (matroska_deliver_packet(matroska, pkt)) {
> int64_t pos = avio_tell(matroska->ctx->pb);
> if (matroska->done)
> - return AVERROR_EOF;
> + return avio_feof(s->pb) ? AVERROR_EOF : AVERROR(EIO);
> if (matroska_parse_cluster(matroska) < 0)
> matroska_resync(matroska, pos);
> }
This does not seem correct. EIO means something (usually along the lines
from "you should not unplug your USB stick while watching a file stored on
it" to "get a new hard drive and hope your backups are up to date"), it is
not a generic error when nothing else fits; there is AVERROR_UNKNOWN for
that.
But I do not think AVERROR_UNKNOWN would be correct either. If I read the
code correctly, the only way for matroska->done to mean something else than
EOF is avio_seek() returning an error in matroska_resync(): its return value
is checked for error but the exact value is discarded. Note that the return
value of matroska_resync() is later ignored. (I also notice that the return
value of avio_seek() is ignored all over the place in this file.)
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/20160723/09e7f16b/attachment.sig>
More information about the ffmpeg-devel
mailing list