• Andreas Rheinhardt's avatar
    avcodec/wrapped_avframe: Don't leak frame metadata, side-data · 425b309f
    Andreas Rheinhardt authored
    wrapped_avframe_decode() uses an AVFrame as dst in av_frame_move_ref()
    after having called ff_decode_frame_props() to attach side-date
    to this very frame. This leaks all the side-data and metadata
    that ff_decode_frame_props() has attached.
    
    This happens in various fate-filter-metadata tests since
    6ca43a96.
    
    These particular leaks (which affect metadata-only)
    could be fixed by not adding metadata side-data to AVPackets
    in libavdevice if they are also available from the AVFrames.
    Yet this would break users that extract the metadata from
    AVPackets.
    
    The changes to FATE happen because of the way av_dict_set()
    works when it overwrites an already existing entry:
    It overwrites the entry to be overwritten with the last entry
    and adds the new entry at the end. The end result is that
    the first entry of the dict is the second-to-last-entry of
    the original dict, the last entry of the dict is the last
    entry of the old dict and the first count - 2 entries
    of the original dict are at positions 1..count - 2 in their
    original order.
    Reviewed-by: 's avatarTimo Rothenpieler <timo@rothenpieler.org>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
    425b309f
filter-metadata-signalstats-yuv420p 885 Bytes