From 411065bfa9a7296a5030f1d78aa08466b2551b05 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Thu, 20 Apr 2017 14:58:16 +0900 Subject: [PATCH] Fix invalid volume value when recording value is zero Change-Id: I05c815b192380c575da1b4217bd26e8f2f5c81bf --- server/vcd_recorder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 4d3cb7e..5ba69d6 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -514,8 +514,8 @@ static float get_volume_decibel(char* data, int size) count++; } - if (0 == count) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] NULL data"); + if (0 == count || 0 == square_sum) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] No data"); rms = 1.0; } else { rms = sqrt((float)square_sum/count); -- 2.34.1