diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2024-02-22 17:37:01 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2024-03-01 17:23:38 +0800 |
commit | 35dc129940246088d376e5c343b8076ffbea2b64 (patch) | |
tree | d53f59a2ee8cd1422400d1dd68cf18f8251c2465 | |
parent | b56b343e43e595c62f204d5797d33645f4c46d96 (diff) |
avcodec/encode: Fix default setting of bits_per_raw_sample
bits_per_raw_sample doesn't always match size of AV_SAMPLE_FMT_,
e.g., S24.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
-rw-r--r-- | libavcodec/encode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/encode.c b/libavcodec/encode.c index a436be2657..8ca07814ee 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -737,6 +737,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); return 0; |