[FFmpeg-cvslog] lavc/encode: pick a sane default for bits_per_raw_sample if it's not set

Anton Khirnov git at videolan.org
Wed Apr 13 13:57:00 EEST 2022


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jan 20 16:56:53 2022 +0100| [e663030267851e0e0be54dc9d685fa9cd883cef6] | committer: Anton Khirnov

lavc/encode: pick a sane default for bits_per_raw_sample if it's not set

Fixes #9563.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e663030267851e0e0be54dc9d685fa9cd883cef6
---

 libavcodec/encode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 85b8e089dd..6ae47b736c 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -555,6 +555,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
+    if (!avctx->bits_per_raw_sample)
+        avctx->bits_per_raw_sample = 8 * av_get_bytes_per_sample(avctx->sample_fmt);
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list