[Freeswitch-svn] [commit] r3670 - freeswitch/trunk/src/mod/applications/mod_conference
Freeswitch SVN
anthm at freeswitch.org
Fri Dec 15 12:01:02 EST 2006
Author: anthm
Date: Fri Dec 15 12:01:01 2006
New Revision: 3670
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
avoid potential div by zero
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Dec 15 12:01:01 2006
@@ -3256,14 +3256,15 @@
int16_t *data;
data = read_frame->data;
- samples = read_frame->datalen / sizeof(*data);
+ if ((samples = read_frame->datalen / sizeof(*data))) {
- for (i = 0; i < samples; i++) {
- energy += abs(data[j]);
- j += read_codec->implementation->number_of_channels;
- }
+ for (i = 0; i < samples; i++) {
+ energy += abs(data[j]);
+ j += read_codec->implementation->number_of_channels;
+ }
- score = energy / samples;
+ score = energy / samples;
+ }
if (score > energy_level) {
uint32_t diff = score - energy_level;
More information about the Freeswitch-svn
mailing list