mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-29 07:59:16 +00:00
lavf: Update AVIOContext.maxsize when hitting the end.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
39f59a8da7
commit
559ae20dda
1 changed files with 10 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue