Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8793c2ed
提交
8793c2ed
authored
6月 17, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory issue in spandsp_tone_detect
上级
bf2b27a9
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
7 行删除
+29
-7
mod_fifo.c
src/mod/applications/mod_fifo/mod_fifo.c
+18
-3
mod_spandsp_dsp.c
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
+11
-4
没有找到文件。
src/mod/applications/mod_fifo/mod_fifo.c
浏览文件 @
8793c2ed
...
@@ -489,6 +489,19 @@ struct fifo_chime_data {
...
@@ -489,6 +489,19 @@ struct fifo_chime_data {
typedef
struct
fifo_chime_data
fifo_chime_data_t
;
typedef
struct
fifo_chime_data
fifo_chime_data_t
;
static
switch_status_t
chime_read_frame_callback
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
void
*
user_data
)
{
fifo_chime_data_t
*
cd
=
(
fifo_chime_data_t
*
)
user_data
;
if
(
cd
&&
cd
->
orbit_timeout
&&
switch_epoch_time_now
(
NULL
)
>=
cd
->
orbit_timeout
)
{
cd
->
do_orbit
=
1
;
return
SWITCH_STATUS_BREAK
;
}
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
caller_read_frame_callback
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
void
*
user_data
)
static
switch_status_t
caller_read_frame_callback
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
void
*
user_data
)
{
{
fifo_chime_data_t
*
cd
=
(
fifo_chime_data_t
*
)
user_data
;
fifo_chime_data_t
*
cd
=
(
fifo_chime_data_t
*
)
user_data
;
...
@@ -510,6 +523,8 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
...
@@ -510,6 +523,8 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
args
.
input_callback
=
moh_on_dtmf
;
args
.
input_callback
=
moh_on_dtmf
;
args
.
buf
=
buf
;
args
.
buf
=
buf
;
args
.
buflen
=
sizeof
(
buf
);
args
.
buflen
=
sizeof
(
buf
);
args
.
read_frame_callback
=
chime_read_frame_callback
;
args
.
user_data
=
user_data
;
if
(
switch_ivr_play_file
(
session
,
NULL
,
cd
->
list
[
cd
->
index
],
&
args
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_ivr_play_file
(
session
,
NULL
,
cd
->
list
[
cd
->
index
],
&
args
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_BREAK
;
return
SWITCH_STATUS_BREAK
;
...
@@ -522,10 +537,10 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
...
@@ -522,10 +537,10 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session
cd
->
next
=
switch_epoch_time_now
(
NULL
)
+
cd
->
freq
;
cd
->
next
=
switch_epoch_time_now
(
NULL
)
+
cd
->
freq
;
cd
->
index
++
;
cd
->
index
++
;
}
}
}
else
if
(
cd
->
orbit_timeout
&&
switch_epoch_time_now
(
NULL
)
>=
cd
->
orbit_timeout
)
{
}
else
{
cd
->
do_orbit
=
1
;
chime_read_frame_callback
(
session
,
frame
,
user_data
);
return
SWITCH_STATUS_BREAK
;
}
}
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
浏览文件 @
8793c2ed
...
@@ -173,7 +173,7 @@ static globals_t globals;
...
@@ -173,7 +173,7 @@ static globals_t globals;
*/
*/
#define MAX_TONES 32
#define MAX_TONES 32
#define STRLEN 128
/**
/**
* Tone descriptor
* Tone descriptor
*
*
...
@@ -187,7 +187,9 @@ struct tone_descriptor {
...
@@ -187,7 +187,9 @@ struct tone_descriptor {
super_tone_rx_descriptor_t
*
spandsp_tone_descriptor
;
super_tone_rx_descriptor_t
*
spandsp_tone_descriptor
;
/** The mapping of tone id to key */
/** The mapping of tone id to key */
const
char
*
tone_keys
[
MAX_TONES
];
char
tone_keys
[
MAX_TONES
][
STRLEN
];
int
idx
;
};
};
typedef
struct
tone_descriptor
tone_descriptor_t
;
typedef
struct
tone_descriptor
tone_descriptor_t
;
...
@@ -256,7 +258,11 @@ static int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *k
...
@@ -256,7 +258,11 @@ static int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *k
if
(
id
>=
MAX_TONES
)
{
if
(
id
>=
MAX_TONES
)
{
return
-
1
;
return
-
1
;
}
}
descriptor
->
tone_keys
[
id
]
=
key
;
switch_set_string
(
descriptor
->
tone_keys
[
id
],
key
);
if
(
id
>
descriptor
->
idx
)
{
descriptor
->
idx
=
id
;
}
return
id
;
return
id
;
}
}
...
@@ -358,7 +364,8 @@ static switch_bool_t tone_detector_process_buffer(tone_detector_t *detector, voi
...
@@ -358,7 +364,8 @@ static switch_bool_t tone_detector_process_buffer(tone_detector_t *detector, voi
{
{
detector
->
detected_tone
=
-
1
;
detector
->
detected_tone
=
-
1
;
super_tone_rx
(
detector
->
spandsp_detector
,
data
,
len
);
super_tone_rx
(
detector
->
spandsp_detector
,
data
,
len
);
if
(
detector
->
detected_tone
!=
-
1
)
{
if
(
detector
->
detected_tone
>
-
1
&&
detector
->
detected_tone
<
detector
->
descriptor
->
idx
&&
detector
->
detected_tone
<
MAX_TONES
)
{
*
key
=
detector
->
descriptor
->
tone_keys
[
detector
->
detected_tone
];
*
key
=
detector
->
descriptor
->
tone_keys
[
detector
->
detected_tone
];
return
SWITCH_TRUE
;
return
SWITCH_TRUE
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论