• Andreas Rheinhardt's avatar
    mpeg4_unpack_bframes: Avoid allocations and copies of packet structures · eb17bf6f
    Andreas Rheinhardt authored
    1. Since bd90a2ec, mpeg4_unpack_bframes caches whole packets instead of
    just the pointer to the buffer and the buffer's size in order to be able
    to make use of refcounting to avoid copying of data; this unfortunately
    introduced copies of packet structures and side data (if existing),
    although the only fields that are needed are the buffer-related ones
    (data, size and buf). This can be changed without compromising the
    advantages of refcounting by storing a reference to the buffer.
    
    2. This change also makes it easy to use only one packet throughout
    so that an allocation and free of an AVPacket structure per filtered
    packet can be saved by switching to ff_bsf_get_packet_ref.
    
    3. Furthermore, this commit also fixes a memleak introduced in bd90a2ec:
    If a stored b_frame with side data was used for a later frame, the side
    data would leak when the input frame's properties were copied into the
    output frame.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    eb17bf6f
mpeg4_unpack_bframes_bsf.c 5.61 KB