[FFmpeg-devel] [PATCH] avpacket: Set dst->side_data_elems to 0 within av_packet_copy_props.

Yusuke Nakamura muken.the.vfrmaniac at gmail.com
Wed Feb 14 04:43:24 EET 2018


This makes you need not call av_init_packet before av_packet_copy_props like the following.

AVPacket dst;
av_packet_copy_props(&dst, &src);
---
 libavcodec/avpacket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 90b8215928..1a9be60e20 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -571,6 +571,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     dst->flags                = src->flags;
     dst->stream_index         = src->stream_index;
 
+    dst->side_data_elems = 0;
     for (i = 0; i < src->side_data_elems; i++) {
          enum AVPacketSideDataType type = src->side_data[i].type;
          int size          = src->side_data[i].size;
-- 
2.16.1.windows.4



More information about the ffmpeg-devel mailing list