Browse code

[dv] Check return value of avio_seek and avoid modifying state if it fails

Joakim Plate authored on 2011/09/15 02:24:25
Showing 1 changed files
... ...
@@ -475,10 +475,11 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
475 475
     DVDemuxContext *c = r->dv_demux;
476 476
     int64_t offset    = dv_frame_offset(s, c, timestamp, flags);
477 477
 
478
-    dv_offset_reset(c, offset / c->sys->frame_size);
478
+    if (avio_seek(s->pb, offset, SEEK_SET) < 0)
479
+        return -1;
479 480
 
480
-    offset = avio_seek(s->pb, offset, SEEK_SET);
481
-    return (offset < 0) ? offset : 0;
481
+    dv_offset_reset(c, offset / c->sys->frame_size);
482
+    return 0;
482 483
 }
483 484
 
484 485
 static int dv_read_close(AVFormatContext *s)