[FFmpeg-devel] [PATCH 2/2] avcodec/libfdk-aacenc: export CPB properties

James Almer jamrial at gmail.com
Mon Nov 18 04:01:38 EET 2024


Needed to signal the muxer that the stream is VBR.

Finishes fixing ticket #11303.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/libfdk-aacenc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 1a9df88c13..4dcfb25db7 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -178,6 +178,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
     AACContext *s = avctx->priv_data;
     int ret = AVERROR(EINVAL);
     AACENC_InfoStruct info = { 0 };
+    AVCPBProperties *cpb_props;
     CHANNEL_MODE mode;
     AACENC_ERROR err;
     int aot = AV_PROFILE_AAC_LOW + 1;
@@ -438,6 +439,14 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
 
         memcpy(avctx->extradata, info.confBuf, info.confSize);
     }
+
+    cpb_props = ff_encode_add_cpb_side_data(avctx);
+    if (!cpb_props)
+        return AVERROR(ENOMEM);
+    cpb_props->max_bitrate =
+    cpb_props->min_bitrate =
+    cpb_props->avg_bitrate = avctx->bit_rate;
+
     return 0;
 error:
     aac_encode_close(avctx);
-- 
2.47.0



More information about the ffmpeg-devel mailing list