Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f8d26368
提交
f8d26368
authored
3月 30, 2013
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--resolve FS-5243 improve mod_unimrcp audio buffering
上级
49138460
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
7 行删除
+18
-7
mod_unimrcp.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
+18
-7
没有找到文件。
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
浏览文件 @
f8d26368
...
@@ -172,7 +172,7 @@ static switch_xml_config_item_t instructions[] = {
...
@@ -172,7 +172,7 @@ static switch_xml_config_item_t instructions[] = {
"EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG"
,
"Logging level for UniMRCP"
),
"EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG"
,
"Logging level for UniMRCP"
),
SWITCH_CONFIG_ITEM_STRING_STRDUP
(
"enable-profile-events"
,
CONFIG_REQUIRED
,
&
globals
.
enable_profile_events_param
,
"false"
,
""
,
SWITCH_CONFIG_ITEM_STRING_STRDUP
(
"enable-profile-events"
,
CONFIG_REQUIRED
,
&
globals
.
enable_profile_events_param
,
"false"
,
""
,
"Fire profile events (true|false)"
),
"Fire profile events (true|false)"
),
SWITCH_CONFIG_ITEM_STRING_STRDUP
(
"request-timeout"
,
CONFIG_REQUIRED
,
&
globals
.
unimrcp_request_timeout
,
"10000"
,
""
,
SWITCH_CONFIG_ITEM_STRING_STRDUP
(
"request-timeout"
,
CONFIG_REQUIRED
,
&
globals
.
unimrcp_request_timeout
,
"10000"
,
""
,
"Maximum time to wait for server response to a request"
),
"Maximum time to wait for server response to a request"
),
SWITCH_CONFIG_ITEM_END
()
SWITCH_CONFIG_ITEM_END
()
};
};
...
@@ -273,7 +273,8 @@ static switch_status_t audio_queue_destroy(audio_queue_t *queue);
...
@@ -273,7 +273,8 @@ static switch_status_t audio_queue_destroy(audio_queue_t *queue);
* SPEECH_CHANNEL : speech functions common to recognizer and synthesizer
* SPEECH_CHANNEL : speech functions common to recognizer and synthesizer
*/
*/
#define SPEECH_CHANNEL_TIMEOUT_USEC (5 * 1000000)
#define SPEECH_CHANNEL_TIMEOUT_USEC (5000 * 1000)
#define AUDIO_TIMEOUT_USEC (SWITCH_MAX_INTERVAL * 1000)
/**
/**
* Type of MRCP channel
* Type of MRCP channel
...
@@ -725,11 +726,18 @@ static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch
...
@@ -725,11 +726,18 @@ static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch
#endif
#endif
switch_mutex_lock
(
queue
->
mutex
);
switch_mutex_lock
(
queue
->
mutex
);
/* allow the initial frame to buffer */
if
(
!
queue
->
read_bytes
&&
switch_buffer_inuse
(
queue
->
buffer
)
<
requested
)
{
*
data_len
=
0
;
status
=
SWITCH_STATUS_SUCCESS
;
goto
done
;
}
/* wait for data, if allowed */
/* wait for data, if allowed */
if
(
block
)
{
if
(
block
)
{
while
(
switch_buffer_inuse
(
queue
->
buffer
)
<
requested
)
{
while
(
switch_buffer_inuse
(
queue
->
buffer
)
<
requested
)
{
queue
->
waiting
=
requested
;
queue
->
waiting
=
requested
;
if
(
switch_thread_cond_timedwait
(
queue
->
cond
,
queue
->
mutex
,
SPEECH_CHANNEL
_TIMEOUT_USEC
)
==
SWITCH_STATUS_TIMEOUT
)
{
if
(
switch_thread_cond_timedwait
(
queue
->
cond
,
queue
->
mutex
,
AUDIO
_TIMEOUT_USEC
)
==
SWITCH_STATUS_TIMEOUT
)
{
break
;
break
;
}
}
}
}
...
@@ -774,6 +782,9 @@ static switch_status_t audio_queue_clear(audio_queue_t *queue)
...
@@ -774,6 +782,9 @@ static switch_status_t audio_queue_clear(audio_queue_t *queue)
switch_buffer_zero
(
queue
->
buffer
);
switch_buffer_zero
(
queue
->
buffer
);
switch_thread_cond_signal
(
queue
->
cond
);
switch_thread_cond_signal
(
queue
->
cond
);
switch_mutex_unlock
(
queue
->
mutex
);
switch_mutex_unlock
(
queue
->
mutex
);
queue
->
read_bytes
=
0
;
queue
->
write_bytes
=
0
;
queue
->
waiting
=
0
;
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -3222,7 +3233,7 @@ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsig
...
@@ -3222,7 +3233,7 @@ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsig
* Process asr_feed_dtmf request from FreeSWITCH
* Process asr_feed_dtmf request from FreeSWITCH
*
*
* @param ah the FreeSWITCH speech recognition handle
* @param ah the FreeSWITCH speech recognition handle
* @return SWITCH_STATUS_SUCCESS if successful
* @return SWITCH_STATUS_SUCCESS if successful
*/
*/
static
switch_status_t
recog_asr_feed_dtmf
(
switch_asr_handle_t
*
ah
,
const
switch_dtmf_t
*
dtmf
,
switch_asr_flag_t
*
flags
)
static
switch_status_t
recog_asr_feed_dtmf
(
switch_asr_handle_t
*
ah
,
const
switch_dtmf_t
*
dtmf
,
switch_asr_flag_t
*
flags
)
{
{
...
@@ -3507,9 +3518,9 @@ static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *cod
...
@@ -3507,9 +3518,9 @@ static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *cod
{
{
speech_channel_t
*
schannel
=
(
speech_channel_t
*
)
stream
->
obj
;
speech_channel_t
*
schannel
=
(
speech_channel_t
*
)
stream
->
obj
;
recognizer_data_t
*
r
=
(
recognizer_data_t
*
)
schannel
->
data
;
recognizer_data_t
*
r
=
(
recognizer_data_t
*
)
schannel
->
data
;
r
->
unimrcp_stream
=
stream
;
r
->
unimrcp_stream
=
stream
;
return
TRUE
;
return
TRUE
;
}
}
...
@@ -3534,7 +3545,7 @@ static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *fra
...
@@ -3534,7 +3545,7 @@ static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *fra
frame
->
type
|=
MEDIA_FRAME_TYPE_AUDIO
;
frame
->
type
|=
MEDIA_FRAME_TYPE_AUDIO
;
}
}
switch_mutex_lock
(
schannel
->
mutex
);
switch_mutex_lock
(
schannel
->
mutex
);
if
(
r
->
dtmf_generator_active
)
{
if
(
r
->
dtmf_generator_active
)
{
if
(
!
mpf_dtmf_generator_put_frame
(
r
->
dtmf_generator
,
frame
))
{
if
(
!
mpf_dtmf_generator_put_frame
(
r
->
dtmf_generator
,
frame
))
{
if
(
!
mpf_dtmf_generator_sending
(
r
->
dtmf_generator
))
if
(
!
mpf_dtmf_generator_sending
(
r
->
dtmf_generator
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论