• Andreas Rheinhardt's avatar
    avformat/mux: Don't modify packets we don't own · fe251f77
    Andreas Rheinhardt authored
    The documentation of av_write_frame() explicitly states that the function
    doesn't take ownership of the packets sent to it; while av_write_frame()
    does not directly unreference the packets after having written them, it
    nevertheless modifies the packet in various ways:
    1. The timestamps might be modified either by prepare_input_packet() or
    compute_muxer_pkt_fields().
    2. If a bitstream filter gets applied, it takes ownership of the
    reference and the side-data in the packet sent to it.
    In case of do_packet_auto_bsf(), the end result is that the returned packet
    contains the output of the last bsf in the chain. If an error happens,
    a blank packet will be returned; a packet may also simply not lead to
    any output (vp9_superframe).
    This also implies that side data needs to be really copied and can't be
    shared with the input packet.
    The method choosen here minimizes copying of data: When the input isn't
    refcounted and no bitstream filter is applied, the packet's data will
    not be copied.
    
    Notice that packets that contain uncoded frames are exempt from this
    because these packets are not owned by and returned to the user. This
    also moves unreferencing the packets containing uncoded frames to
    av_write_frame() in the noninterleaved codepath; in the interleaved
    codepath, these packets are already freed in av_interleaved_write_frame(),
    so that unreferencing the packets in write_uncoded_frame_internal() is
    no longer needed. It has been removed.
    Reviewed-by: 's avatarMarton Balint <cus@passwd.hu>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    fe251f77
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...