From 8ba987bff3004de6952ccab90d9b8acc6135a37a Mon Sep 17 00:00:00 2001 From: Yan Jing Date: Thu, 8 Sep 2011 20:23:13 +0200 Subject: [PATCH] ffmdec: set avio buffer to ffm->packet_size, avoid dirty reads --- libavformat/ffmdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 42c1466e445..feb136a3f64 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) -- 2.39.2