[FFmpeg-trac] #2839(undetermined:new): Wasted work in av_new_program() and avpriv_new_chapter()

FFmpeg trac at avcodec.org
Tue Aug 6 23:11:17 CEST 2013


#2839: Wasted work in av_new_program() and avpriv_new_chapter()
-------------------------------------+-------------------------------------
             Reporter:  pchang9      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  performance  |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 The problem appears in latest revision. I have attached a simple one-line
 patch that fixes it.

 In method av_new_program() in libavformat/utils.c, the loop in line 3431
 keeps overriding "program" with "ac->programs[i]" when its "id" equals to
 "id" Therefore, only the last written value is visible out of the loop and
 all the other writes and iterations are not necessary. The patch iterates
 from the end of "i" and breaks the first time when "program" is set.

 Similar problem also appears in avpriv_new_chapter(), the loop in line
 3457. The patch iterates from the end of "i" and breaks the first time
 when "chapter" is set.

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


More information about the FFmpeg-trac mailing list