[FFmpeg-devel] [PATCH] lavf/mux: do not pass a copy of the packet to write_packet().

Michael Niedermayer michaelni at gmx.at
Tue Jan 8 22:57:59 CET 2013


On Tue, Jan 08, 2013 at 10:40:21PM +0100, Clément Bœsch wrote:
> Sometimes the muxer modifies the packet (like for instance lavf/mp3enc
> changing pkt->destruct in order to keep a copy), so these changes must
> be kept.
> 
> Fixes #2124.
> ---
>  libavformat/mux.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index c7e176a..c34a294 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -490,13 +490,12 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
>   */
>  static inline int split_write_packet(AVFormatContext *s, AVPacket *pkt)
>  {
> -    int ret;
> -    AVPacket spkt = *pkt;
> +    int ret, did_split;
>  
> -    av_packet_split_side_data(&spkt);
> -    ret = s->oformat->write_packet(s, &spkt);
> -    spkt.data = NULL;
> -    av_destruct_packet(&spkt);
> +    did_split = av_packet_split_side_data(pkt);
> +    ret = s->oformat->write_packet(s, pkt);
> +    if (did_split)
> +        av_packet_merge_side_data(pkt);
>      return ret;

if that works better sure ok&LGTM

i wouldnt call what mp3enc does correct though

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130108/2a14e12f/attachment.asc>


More information about the ffmpeg-devel mailing list