[FFmpeg-devel] [PATCH 2/2] avcodec/encode: Fix default setting of bits_per_raw_sample
Zhao Zhili
quinkblack at foxmail.com
Thu Feb 22 11:37:01 EET 2024
From: Zhao Zhili <zhilizhao at tencent.com>
bits_per_raw_sample doesn't always match size of AV_SAMPLE_FMT_,
e.g., S24.
---
libavcodec/encode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index a436be2657..8ca07814ee 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -736,6 +736,8 @@ static int encode_preinit_audio(AVCodecContext *avctx)
}
}
+ if (!avctx->bits_per_raw_sample)
+ avctx->bits_per_raw_sample = av_get_exact_bits_per_sample(avctx->codec_id);
if (!avctx->bits_per_raw_sample)
avctx->bits_per_raw_sample = 8 * av_get_bytes_per_sample(avctx->sample_fmt);
--
2.25.1
More information about the ffmpeg-devel
mailing list