[FFmpeg-cvslog] ffmdec: set avio buffer to ffm->packet_size, avoid dirty reads

Yan Jing git at videolan.org
Thu Sep 8 21:01:47 CEST 2011


ffmpeg | branch: master | Yan Jing <yanjng at 21cn.com> | Thu Sep  8 20:23:13 2011 +0200| [8ba987bff3004de6952ccab90d9b8acc6135a37a] | committer: Michael Niedermayer

ffmdec: set avio buffer to ffm->packet_size, avoid dirty reads

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ba987bff3004de6952ccab90d9b8acc6135a37a
---

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

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 42c1466..feb136a 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -121,6 +121,11 @@ static int ffm_read_data(AVFormatContext *s,
             if (avio_tell(pb) == ffm->file_size)
                 avio_seek(pb, ffm->packet_size, SEEK_SET);
     retry_read:
+            if (pb->buffer_size != ffm->packet_size) {
+                int64_t tell = avio_tell(pb);
+                url_setbufsize(pb, ffm->packet_size);
+                avio_seek(pb, tell, SEEK_SET);
+            }
             id = avio_rb16(pb); /* PACKET_ID */
             if (id != PACKET_ID)
                 if (ffm_resync(s, id) < 0)



More information about the ffmpeg-cvslog mailing list