[FFmpeg-devel] Duplicating an AVPacket along with side data

Vignesh Venkatasubramanian vigneshv at google.com
Fri May 3 00:29:29 CEST 2013


Right now av_dup_packet doesn't seem to duplicate side_data (after a
very recent change). From what i understand, every call to
av_dup_packet requires it's own call to av_free_packet (please correct
me if i am wrong). The current behavior of av_dup_packet fails with
the following workflow when side_data is present.

// pkt is the original packet with side data
dup_pkt = pkt;
av_dup_packet(&dup_pkt); // this doesn't duplicate side_data
av_free_packet(&dup_pkt); // this succeeds and frees the only copy of
the side_data
av_free_packet(&pkt); // this call fails as side_data has already been freed.

I am encountering this exact flow as i am working on a change that
comes across duplicating an AVPacket with side data.

Any thoughts on how i should proceed? Shall i add an
"av_dup_packet_with_side_data" and use it for my change? Or should i
use av_copy_packet with the source and destination as the same packet
(as it copies side_data as well) ?


More information about the ffmpeg-devel mailing list