Fix invalid volume value when recording value is zero 93/126093/1
authorKwangyoun Kim <ky85.kim@samsung.com>
Thu, 20 Apr 2017 05:58:16 +0000 (14:58 +0900)
committerKwangyoun Kim <ky85.kim@samsung.com>
Thu, 20 Apr 2017 05:58:48 +0000 (14:58 +0900)
Change-Id: I05c815b192380c575da1b4217bd26e8f2f5c81bf

server/vcd_recorder.c

index 4d3cb7e..5ba69d6 100644 (file)
@@ -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);