Ticket #1711 (closed defect: invalid)
increasing memory in flv - VP6F files
|Reported by:||DonMoir||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
There is a bug in flvdec.c that continues to allocate memory. This memory only appears to be freed when you close the file. If you keep looping the playback the memory continues to increase.
Using this sample file which is AV_CODEC_ID_VP6F:
It comes up with 42 streams in it. One AVMEDIA_TYPE_VIDEO, one AVMEDIA_TYPE_AUDIO, and I think all the rest are AVMEDIA_TYPE_DATA streams.
Note that audio is all silence but not relevent to the problem.
It not necessarily related to just AV_CODEC_ID_VP6F but appears to be a problem in the handling of AVMEDIA_TYPE_DATA streams or related.
So everytime you read a packet and you happen to read a packet that is not a video or audio packet, then memory increases.
I traced this down into flv_read_packet. About midway down you will see /* now find stream */
It checks for a stream of type audio or video and breaks if found.
If the stream is not audio or video, then a check is done: "else if (st->id == stream_type)"
Well st->id is always zero and the stream_type will be 2 for data stream and so it will loop for all 42 streams
So then it does:
if (i == s->nb_streams)... and this will be true always for AVMEDIA_TYPE_DATA.
So since its true, it always calls create_stream and this is what causes the memory increase.
So every time you read a packet that is not audio or video, it will create a stream. These created streams just keep accumlating forever as you loop the video. In normal playback as well, but more evident when you are looping.
I commented out the call to create_stream when (i == s->nb_streams) and there are no more memory increases. But someone needs to look at it.