[FFmpeg-cvslog] avcodec/aacenc: Do not divide by lambda_count if it is 0

Michael Niedermayer git at videolan.org
Fri Jun 18 22:14:46 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Sat May 29 17:49:22 2021 +0200| [27727d56bfee30b3a9e74e8c9a7a498823c17cfe] | committer: Michael Niedermayer

avcodec/aacenc: Do not divide by lambda_count if it is 0

Avoids Floating point division by 0

Fixes: Ticket8011

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c520b986915a3fdf3a20f6ce0ad5833eccfb7a91)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/aacenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index a31da877fb..be5e8e2108 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -898,7 +898,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
 {
     AACEncContext *s = avctx->priv_data;
 
-    av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_sum / s->lambda_count);
+    av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_count ? s->lambda_sum / s->lambda_count : NAN);
 
     ff_mdct_end(&s->mdct1024);
     ff_mdct_end(&s->mdct128);



More information about the ffmpeg-cvslog mailing list