diff mbox series

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

Message ID 20200113185459.8908-5-nicolas.gaullier@cji.paris
State New
Headers show
Series Fix mpeg1/2 stream copy
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Nicolas Gaullier Jan. 13, 2020, 6:54 p.m. UTC
Makes it behave similarly to av_stream_add_side_data().
---
 libavcodec/utils.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

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)