lavf: print an error if a packet has been truncated due to filesize

in av_get_packet()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-12-16 15:46:45 +01:00
parent 207d9eab5a
commit ee181f84a3

View File

@ -278,8 +278,10 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
remaining= s->maxsize - avio_tell(s);
}
if(s->maxsize>=0 && remaining>=0)
size= FFMIN(size, remaining+1);
if(s->maxsize>=0 && remaining>=0 && remaining+1 < size){
av_log(0, AV_LOG_ERROR, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1);
size= remaining+1;
}
}
ret= av_new_packet(pkt, size);