OSDN Git Service

[tta] Check return value of avio_seek and avoid modifying state if it fails
authorJoakim Plate <elupus@ecce.se>
Wed, 14 Sep 2011 17:33:20 +0000 (19:33 +0200)
committerJoakim Plate <elupus@ecce.se>
Wed, 14 Sep 2011 17:53:45 +0000 (19:53 +0200)
libavformat/tta.c

index 5b07b09..23e54b2 100644 (file)
@@ -137,9 +137,10 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     int index = av_index_search_timestamp(st, timestamp, flags);
     if (index < 0)
         return -1;
+    if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+        return -1;
 
     c->currentframe = index;
-    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
 
     return 0;
 }