Signed-off-by: James Almer <jamr...@gmail.com>
---
 libavformat/demux.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 553933a2b0..d7e34aad97 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2976,6 +2976,24 @@ int avformat_find_stream_info(AVFormatContext *ic, 
AVDictionary **options)
             ret = add_coded_side_data(st, sti->avctx);
             if (ret < 0)
                 goto find_stream_info_err;
+
+            if (sti->avctx->rc_buffer_size > 0 || sti->avctx->rc_max_rate > 0 
||
+                sti->avctx->rc_min_rate) {
+                size_t cpb_size;
+                AVCPBProperties *props = av_cpb_properties_alloc(&cpb_size);
+                if (props) {
+                    if (sti->avctx->rc_buffer_size > 0)
+                        props->buffer_size = sti->avctx->rc_buffer_size;
+                    if (sti->avctx->rc_min_rate > 0)
+                        props->min_bitrate = sti->avctx->rc_min_rate;
+                    if (sti->avctx->rc_max_rate > 0)
+                        props->max_bitrate = sti->avctx->rc_max_rate;
+                    if (!av_packet_side_data_set_add(&st->codecpar->side_data,
+                                                     
AV_PKT_DATA_CPB_PROPERTIES,
+                                                     (uint8_t *)props, 
cpb_size, 0))
+                        av_free(props);
+                }
+            }
         }
 
 #if FF_API_AVSTREAM_SIDE_DATA
-- 
2.42.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to