[FFmpeg-devel] [PATCH] avformat/matroskadec: return AVERROR(EIO) rather than AVERROR_EOF on parse error

Sophia Wang skw at google.com
Sun Jul 31 20:22:24 EEST 2016


Since matroska->done is only set to 1 in matroska_resync(), the choice
of error is made by checking the return value of matroska_resync()
rather than checking matroska->done directly on the next
while-iteration.

Signed-off-by: Sophia Wang <skw at google.com>
---
 libavformat/matroskadec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index f3d701f..ed28a90 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3322,10 +3322,10 @@ 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;
-        if (matroska_parse_cluster(matroska) < 0)
-            matroska_resync(matroska, pos);
+        if (matroska_parse_cluster(matroska) < 0) {
+            if (matroska_resync(matroska, pos) < 0)
+                return avio_feof(s->pb) ? AVERROR_EOF : AVERROR(EIO);
+        }
     }
 
     return 0;
-- 
2.8.0.rc3.226.g39d4020



More information about the ffmpeg-devel mailing list