[FFmpeg-devel] [PATCH v2 6/7] avcodec/utils: Fix ff_add_cpb_side_data() add twice

Nicolas Gaullier nicolas.gaullier at cji.paris
Thu Dec 19 18:43:26 EET 2019


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 8a49234bcd..f35cfcf2f9 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1975,6 +1975,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