diff mbox series

[FFmpeg-devel,1/2] avcodec/aacenc: Do not divide by lambda_count if it is 0

Message ID 20210529155818.27398-1-michael@niedermayer.cc
State Accepted
Commit c520b986915a3fdf3a20f6ce0ad5833eccfb7a91
Headers show
Series [FFmpeg-devel,1/2] avcodec/aacenc: Do not divide by lambda_count if it is 0 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 29, 2021, 3:58 p.m. UTC
Avoids Floating point division by 0

Fixes: Ticket8011

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/aacenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 2, 2021, 3:33 p.m. UTC | #1
On Sat, May 29, 2021 at 05:58:17PM +0200, Michael Niedermayer wrote:
> Avoids Floating point division by 0
> 
> Fixes: Ticket8011
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/aacenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index e80591ba86..49feb86b3f 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);