OSDN Git Service

ffmdec: only seek back at EOF if a server is attached
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Wed, 2 Dec 2015 21:25:55 +0000 (22:25 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Fri, 4 Dec 2015 14:20:04 +0000 (15:20 +0100)
Otherwise the ffm demuxer can return the same packets endlessly, if
there is no server attached.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/ffmdec.c

index e7c1449..9ad771e 100644 (file)
@@ -100,7 +100,10 @@ static int ffm_read_data(AVFormatContext *s,
             len = size;
         if (len == 0) {
             if (avio_tell(pb) == ffm->file_size)
-                avio_seek(pb, ffm->packet_size, SEEK_SET);
+                if (ffm->server_attached)
+                    avio_seek(pb, ffm->packet_size, SEEK_SET);
+                else
+                    return AVERROR_EOF;
     retry_read:
             if (pb->buffer_size != ffm->packet_size) {
                 int64_t tell = avio_tell(pb);