mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-20 02:04:54 +00:00
FS-9922: [mod_conference] Auto Energy Level
This commit is contained in:
parent
a0d0dc2d3e
commit
bfe1a84c39
@ -1404,7 +1404,7 @@ SWITCH_STANDARD_API(local_stream_function)
|
||||
stream->write_function(stream, "-ERR invalid auto-volume level for stream: %s\n", source->name);
|
||||
} else {
|
||||
if (!source->agc) {
|
||||
switch_agc_create(&source->agc, source->energy_avg, source->energy_low, 10, 3, (1000 / source->interval) * 2);
|
||||
switch_agc_create(&source->agc, source->energy_avg, source->energy_low, 500, 3, (1000 / source->interval) * 2);
|
||||
} else {
|
||||
switch_agc_set_energy_avg(source->agc, source->energy_avg);
|
||||
switch_agc_set_energy_low(source->agc, source->energy_low);
|
||||
|
@ -513,15 +513,23 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data
|
||||
agc->score_count = 0;
|
||||
agc->score_sum = 0;
|
||||
|
||||
if (agc->score_avg > agc->energy_avg + agc->margin) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] OVER++ SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n",
|
||||
agc->token, agc->score_avg, agc->energy_avg, agc->margin);
|
||||
agc->score_over++;
|
||||
if (agc->score_avg > agc->energy_avg) {
|
||||
if (agc->score_avg - agc->energy_avg > agc->margin) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] OVER++ SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n",
|
||||
agc->token, agc->score_avg, agc->energy_avg, agc->margin);
|
||||
agc->score_over++;
|
||||
}
|
||||
} else {
|
||||
agc->score_over = 0;
|
||||
}
|
||||
|
||||
if (agc->score_avg < agc->energy_avg - agc->margin && (agc->vol < 0 || agc->score_avg > agc->low_energy_point)) {
|
||||
if (agc->score_avg < agc->low_energy_point) {
|
||||
agc->score_under = agc->change_factor + 1;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] BELOW LOW POINT, SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n",
|
||||
agc->token, agc->score_avg, agc->energy_avg, agc->margin);
|
||||
} else if (((agc->score_avg < agc->energy_avg) && (agc->energy_avg - agc->score_avg > agc->margin))) {
|
||||
//&& (agc->vol < 0 || agc->score_avg > agc->low_energy_point)) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] UNDER++ SCORE AVG: %d ENERGY AVG: %d MARGIN: %d\n",
|
||||
agc->token, agc->score_avg, agc->energy_avg, agc->margin);
|
||||
agc->score_under++;
|
||||
@ -536,10 +544,12 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data
|
||||
agc->vol--;
|
||||
switch_normalize_volume_granular(agc->vol);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] VOL DOWN %d\n", agc->token, agc->vol);
|
||||
//agc->score_over = 0;
|
||||
} else if (agc->score_under > agc->change_factor) {
|
||||
agc->vol++;
|
||||
switch_normalize_volume_granular(agc->vol);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "[%s] VOL UP %d\n", agc->token, agc->vol);
|
||||
//agc->score_under = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user