[FFmpeg-devel] [PATCH v6 4/5] avcodec/utils: Fix ff_add_cpb_side_data() add twice

Nicolas Gaullier nicolas.gaullier at cji.paris
Mon Jan 13 20:54:58 EET 2020


Makes it behave similarly to av_stream_add_side_data().
---
 libavcodec/utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ab48754a64..d9af6053bb 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1978,6 +1978,11 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
     AVPacketSideData *tmp;
     AVCPBProperties  *props;
     size_t size;
+    int i;
+
+    for (i = 0; i < avctx->nb_coded_side_data; i++)
+        if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES)
+            return (AVCPBProperties  *)avctx->coded_side_data[i].data;
 
     props = av_cpb_properties_alloc(&size);
     if (!props)
-- 
2.14.1.windows.1



More information about the ffmpeg-devel mailing list