Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f691d139
提交
f691d139
authored
4月 27, 2017
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9922: [mod_conference] Auto Energy Level -- some clean up
上级
c6839a44
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
26 行增加
和
9 行删除
+26
-9
switch_resample.h
src/include/switch_resample.h
+1
-0
conference_api.c
src/mod/applications/mod_conference/conference_api.c
+1
-0
conference_loop.c
src/mod/applications/mod_conference/conference_loop.c
+4
-4
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+1
-1
switch_resample.c
src/switch_resample.c
+19
-4
没有找到文件。
src/include/switch_resample.h
浏览文件 @
f691d139
...
...
@@ -185,6 +185,7 @@ SWITCH_DECLARE(void) switch_agc_destroy(switch_agc_t **agcP);
SWITCH_DECLARE
(
switch_status_t
)
switch_agc_feed
(
switch_agc_t
*
agc
,
int16_t
*
data
,
uint32_t
samples
,
uint32_t
channels
);
SWITCH_DECLARE
(
void
)
switch_agc_set_energy_avg
(
switch_agc_t
*
agc
,
uint32_t
energy_avg
);
SWITCH_DECLARE
(
void
)
switch_agc_set_energy_low
(
switch_agc_t
*
agc
,
uint32_t
low_energy_point
);
SWITCH_DECLARE
(
void
)
switch_agc_set_token
(
switch_agc_t
*
agc
,
const
char
*
token
);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
...
...
src/mod/applications/mod_conference/conference_api.c
浏览文件 @
f691d139
...
...
@@ -957,6 +957,7 @@ void conference_api_set_agc(conference_member_t *member, const char *data)
if
(
!
member
->
agc
)
{
switch_agc_create
(
&
member
->
agc
,
member
->
agc_level
,
member
->
agc_low_energy_level
,
member
->
agc_margin
,
member
->
agc_change_factor
,
member
->
agc_period_len
);
switch_agc_set_token
(
member
->
agc
,
switch_channel_get_name
(
member
->
channel
));
}
else
{
switch_agc_set
(
member
->
agc
,
member
->
agc_level
,
member
->
agc_low_energy_level
,
member
->
agc_margin
,
member
->
agc_change_factor
,
member
->
agc_period_len
);
...
...
src/mod/applications/mod_conference/conference_loop.c
浏览文件 @
f691d139
...
...
@@ -932,10 +932,6 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
switch_change_sln_volume
(
read_frame
->
data
,
(
read_frame
->
datalen
/
2
)
*
member
->
conference
->
channels
,
member
->
volume_in_level
);
}
if
(
member
->
agc
)
{
switch_agc_feed
(
member
->
agc
,
(
int16_t
*
)
read_frame
->
data
,
(
read_frame
->
datalen
/
2
)
*
member
->
conference
->
channels
,
1
);
}
if
((
samples
=
read_frame
->
datalen
/
sizeof
(
*
data
)))
{
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
energy
+=
abs
(
data
[
j
]);
...
...
@@ -951,6 +947,10 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
gate_check
=
conference_member_noise_gate_check
(
member
);
if
(
gate_check
&&
member
->
agc
)
{
switch_agc_feed
(
member
->
agc
,
(
int16_t
*
)
read_frame
->
data
,
(
read_frame
->
datalen
/
2
)
*
member
->
conference
->
channels
,
1
);
}
member
->
score_iir
=
(
int
)
(((
1
.
0
-
SCORE_DECAY
)
*
(
float
)
member
->
score
)
+
(
SCORE_DECAY
*
(
float
)
member
->
score_iir
));
if
(
member
->
score_iir
>
SCORE_MAX_IIR
)
{
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
f691d139
...
...
@@ -3456,7 +3456,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference
->
agc_level
=
0
;
conference
->
agc_low_energy_level
=
0
;
conference
->
agc_margin
=
50
0
;
conference
->
agc_margin
=
2
0
;
conference
->
agc_change_factor
=
3
;
conference
->
agc_period_len
=
(
1000
/
conference
->
interval
)
*
2
;
...
...
src/switch_resample.c
浏览文件 @
f691d139
...
...
@@ -404,7 +404,7 @@ struct switch_agc_s {
uint32_t
energy_avg
;
uint32_t
margin
;
uint32_t
change_factor
;
char
*
token
;
int
vol
;
uint32_t
score
;
uint32_t
score_count
;
...
...
@@ -432,6 +432,7 @@ SWITCH_DECLARE(switch_status_t) switch_agc_create(switch_agc_t **agcP, uint32_t
{
switch_agc_t
*
agc
;
switch_memory_pool_t
*
pool
;
char
id
[
80
]
=
""
;
switch_assert
(
agcP
);
...
...
@@ -442,6 +443,10 @@ SWITCH_DECLARE(switch_status_t) switch_agc_create(switch_agc_t **agcP, uint32_t
switch_agc_set
(
agc
,
energy_avg
,
low_energy_point
,
margin
,
change_factor
,
period_len
);
switch_snprintf
(
id
,
sizeof
(
id
),
"%p"
,
(
void
*
)
agc
);
switch_agc_set_token
(
agc
,
id
);
*
agcP
=
agc
;
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -476,6 +481,11 @@ SWITCH_DECLARE(void) switch_agc_set_energy_low(switch_agc_t *agc, uint32_t low_e
agc
->
low_energy_point
=
low_energy_point
;
}
SWITCH_DECLARE
(
void
)
switch_agc_set_token
(
switch_agc_t
*
agc
,
const
char
*
token
)
{
agc
->
token
=
switch_core_strdup
(
agc
->
pool
,
token
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_agc_feed
(
switch_agc_t
*
agc
,
int16_t
*
data
,
uint32_t
samples
,
uint32_t
channels
)
{
...
...
@@ -504,27 +514,32 @@ SWITCH_DECLARE(switch_status_t) switch_agc_feed(switch_agc_t *agc, int16_t *data
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
++
;
}
else
{
agc
->
score_over
=
0
;
}
if
(
agc
->
score_avg
<
agc
->
energy_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
++
;
}
else
{
agc
->
score_under
=
0
;
}
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"AVG %d over: %d under: %d
\n
"
,
agc
->
score_avg
,
agc
->
score_over
,
agc
->
score_under
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"[%s] AVG %d over: %d under: %d
\n
"
,
agc
->
token
,
agc
->
score_avg
,
agc
->
score_over
,
agc
->
score_under
);
if
(
agc
->
score_over
>
agc
->
change_factor
)
{
agc
->
vol
--
;
switch_normalize_volume_granular
(
agc
->
vol
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"
VOL DOWN %d
\n
"
,
agc
->
vol
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"
[%s] VOL DOWN %d
\n
"
,
agc
->
token
,
agc
->
vol
);
}
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
,
"
VOL UP %d
\n
"
,
agc
->
vol
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"
[%s] VOL UP %d
\n
"
,
agc
->
token
,
agc
->
vol
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论