avformat/id3v2: Use ffio_ensure_seekback() in id3v2_read_internal()
[ffmpeg.git] / libavformat / id3v2.c
index f7fa3ef..0534635 100644 (file)
@@ -1072,7 +1072,9 @@ static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
             break;
         }
 
-        ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
+        ret = ffio_ensure_seekback(pb, ID3v2_HEADER_SIZE);
+        if (ret >= 0)
+            ret = avio_read(pb, buf, ID3v2_HEADER_SIZE);
         if (ret != ID3v2_HEADER_SIZE) {
             avio_seek(pb, off, SEEK_SET);
             break;