lavf/dv: Do not return EIO for every error (like EOF).
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Tue, 1 Sep 2015 22:58:13 +0000 (00:58 +0200)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Tue, 1 Sep 2015 22:59:10 +0000 (00:59 +0200)
Fixes ticket #4818.

Reviewed-by: Ronald S. Bultje
Reviewed-by: Paul B Mahol
libavformat/dv.c

index 8500228..84c3061 100644 (file)
@@ -553,12 +553,17 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
     size = avpriv_dv_get_packet(c->dv_demux, pkt);
 
     if (size < 0) {
+        int ret;
         int64_t pos = avio_tell(s->pb);
         if (!c->dv_demux->sys)
             return AVERROR(EIO);
         size = c->dv_demux->sys->frame_size;
-        if (avio_read(s->pb, c->buf, size) <= 0)
+        ret = avio_read(s->pb, c->buf, size);
+        if (ret < 0) {
+            return ret;
+        } else if (ret == 0) {
             return AVERROR(EIO);
+        }
 
         size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos);
     }