mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-27 05:34:17 +00:00
fix energy stuff to work better on 16khz calls
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6395 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
9cbb6a56a6
commit
7d9e3c577a
3 files changed
+22
-6
No files matched your search
@@ -1382,17 +1382,23 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread,
|
||||
if (switch_test_flag(member, MFLAG_CAN_SPEAK) && energy_level) {
|
||||
uint32_t energy = 0, i = 0, samples = 0, j = 0, score = 0;
|
||||
int16_t *data;
|
||||
int divisor = 0;
|
||||
|
||||
data = read_frame->data;
|
||||
|
||||
if (!(divisor = read_codec->implementation->actual_samples_per_second / 8000)) {
|
||||
divisor = 1;
|
||||
}
|
||||
|
||||
if ((samples = read_frame->datalen / sizeof(*data))) {
|
||||
|
||||
for (i = 0; i < samples; i++) {
|
||||
energy += abs(data[j]);
|
||||
j += read_codec->implementation->number_of_channels;
|
||||
}
|
||||
score = energy / samples;
|
||||
score = energy / (samples / divisor);
|
||||
}
|
||||
|
||||
|
||||
if (score > energy_level) {
|
||||
uint32_t diff = score - energy_level;
|
||||
if (hangover_hits) {
|
||||
|
||||
Reference in new issue
Block a user