[FFmpeg-cvslog] lavf: Update AVIOContext.maxsize when hitting the end.

Michael Niedermayer git at videolan.org
Fri Dec 16 17:18:18 CET 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec 16 15:40:21 2011 +0100| [559ae20dda9e84abf878ee10f8dcea78dacfd0cc] | committer: Michael Niedermayer

lavf: Update AVIOContext.maxsize when hitting the end.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/utils.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 10cd6f3..379ee2b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -269,10 +269,17 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
 {
     int ret;
 
-    if(s->maxsize>0){
+    if(s->maxsize>=0){
         int64_t remaining= s->maxsize - avio_tell(s);
-        if(remaining>=0)
-            size= FFMIN(size, remaining);
+        if(remaining < size){
+            int64_t newsize= avio_size(s);
+            if(!s->maxsize || s->maxsize<newsize)
+                s->maxsize= newsize;
+            remaining= s->maxsize - avio_tell(s);
+        }
+
+        if(s->maxsize>=0 && remaining>=0)
+            size= FFMIN(size, remaining+1);
     }
 
     ret= av_new_packet(pkt, size);



More information about the ffmpeg-cvslog mailing list