Commit 559ae20d authored by Michael Niedermayer's avatar Michael Niedermayer

lavf: Update AVIOContext.maxsize when hitting the end.

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 39f59a8d
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment