[FFmpeg-devel] [PATCH 06/28] fixed: #5585 Media file gets played twice. we assume avi EOF when we can't find the next streams index entry for non interleaved files.

Mans Rullgard mans
Wed Jun 30 11:09:34 CEST 2010


From: Cory Fields <theuni-nospam- at xbmc.org>

---
 libavformat/avidec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 730b3b7..befaa79 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -738,7 +738,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
         if(i>=0){
             int64_t pos= best_st->index_entries[i].pos;
             pos += best_ast->packet_size - best_ast->remaining;
-            url_fseek(s->pb, pos + 8, SEEK_SET);
+            if(url_fseek(s->pb, pos + 8, SEEK_SET) < 0)
+              return AVERROR_EOF;
 //        av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
 
             assert(best_ast->remaining <= best_ast->packet_size);
@@ -748,6 +749,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
                 best_ast->packet_size=
                 best_ast->remaining= best_st->index_entries[i].size;
         }
+        else
+          return AVERROR_EOF;
     }
 
 resync:
-- 
1.7.1.1




More information about the ffmpeg-devel mailing list