[FFmpeg-trac] #1711(undetermined:new): increasing memory in flv - VP6F files

FFmpeg trac at avcodec.org
Sun Sep 2 03:18:06 CEST 2012

#1711: increasing memory in flv - VP6F files
             Reporter:  DonMoir      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 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

 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

 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

 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.

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1711>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list