mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-24 09:23:37 +08:00
lavf: add internal AVIOContext.maxsize
This allows simple and generic limiting of allocations used for packets. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -267,7 +267,15 @@ AVInputFormat *av_find_input_format(const char *short_name)
|
||||
|
||||
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
||||
{
|
||||
int ret= av_new_packet(pkt, size);
|
||||
int ret;
|
||||
|
||||
if(s->maxsize>0){
|
||||
int64_t remaining= s->maxsize - avio_tell(s);
|
||||
if(remaining>=0)
|
||||
size= FFMIN(size, remaining);
|
||||
}
|
||||
|
||||
ret= av_new_packet(pkt, size);
|
||||
|
||||
if(ret<0)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user