Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c4832b4b
提交
c4832b4b
authored
1月 04, 2008
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add lock
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@7079
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
021ab87f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
8 行删除
+35
-8
default.xml
conf/dialplan/default.xml
+3
-2
switch_core_pvt.h
src/include/private/switch_core_pvt.h
+1
-0
switch_core_io.c
src/switch_core_io.c
+30
-6
switch_core_session.c
src/switch_core_session.c
+1
-0
没有找到文件。
conf/dialplan/default.xml
浏览文件 @
c4832b4b
...
...
@@ -196,6 +196,7 @@
-->
<extension
name=
"unpark"
>
<condition
field=
"destination_number"
expression=
"^5901$"
>
<action
application=
"answer"
/>
<action
application=
"fifo"
data=
"5900@$${domain} out nowait"
/>
</condition>
</extension>
...
...
@@ -209,7 +210,7 @@
-->
<extension
name=
"park"
>
<condition
field=
"source"
expression=
"mod_sofia"
continue=
"on-true"
/>
<condition
field=
"
${sip_refer_to}"
expression=
"park\+(.*)@(.*)>
"
continue=
"on-true"
>
<condition
field=
"
destination_number"
expression=
"park\+(\d+)
"
continue=
"on-true"
>
<action
application=
"fifo"
data=
"$1@$${domain} in undef $${moh_uri}"
/>
</condition>
</extension>
...
...
@@ -222,7 +223,7 @@
<condition
field=
"destination_number"
expression=
"^parking$"
continue=
"on-true"
/>
<condition
field=
"${sip_to_params}"
expression=
"fifo\=(\d+)"
>
<action
application=
"answer"
/>
<action
application=
"fifo"
data=
"$1@$${domain} out
undef
"
/>
<action
application=
"fifo"
data=
"$1@$${domain} out
nowait
"
/>
</condition>
</extension>
...
...
src/include/private/switch_core_pvt.h
浏览文件 @
c4832b4b
...
...
@@ -119,6 +119,7 @@ struct switch_core_session {
switch_audio_resampler_t
*
write_resampler
;
switch_mutex_t
*
mutex
;
switch_mutex_t
*
resample_mutex
;
switch_thread_cond_t
*
cond
;
switch_thread_rwlock_t
*
rwlock
;
...
...
src/switch_core_io.c
浏览文件 @
c4832b4b
...
...
@@ -191,11 +191,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch
(
status
)
{
case
SWITCH_STATUS_RESAMPLE
:
if
(
!
session
->
read_resampler
)
{
if
(
switch_resample_create
(
&
session
->
read_resampler
,
read_frame
->
codec
->
implementation
->
actual_samples_per_second
,
read_frame
->
codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
read_codec
->
implementation
->
actual_samples_per_second
,
session
->
read_codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
status
=
switch_resample_create
(
&
session
->
read_resampler
,
read_frame
->
codec
->
implementation
->
actual_samples_per_second
,
read_frame
->
codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
read_codec
->
implementation
->
actual_samples_per_second
,
session
->
read_codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
pool
);
switch_mutex_unlock
(
session
->
resample_mutex
);
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Unable to allocate resampler
\n
"
);
status
=
SWITCH_STATUS_FALSE
;
goto
done
;
...
...
@@ -213,8 +217,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
break
;
case
SWITCH_STATUS_NOOP
:
if
(
session
->
read_resampler
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
switch_resample_destroy
(
&
session
->
read_resampler
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Deactivating read resampler
\n
"
);
switch_mutex_unlock
(
session
->
resample_mutex
);
}
status
=
SWITCH_STATUS_SUCCESS
;
...
...
@@ -240,6 +246,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
#if 0
if (session->read_resampler) {
short *data = read_frame->data;
switch_mutex_lock(session->resample_mutex);
session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2);
session->read_resampler->to_len =
...
...
@@ -249,6 +256,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
read_frame->samples = session->read_resampler->to_len;
read_frame->datalen = session->read_resampler->to_len * 2;
read_frame->rate = session->read_resampler->to_rate;
switch_mutex_unlock(session->resample_mutex);
}
#endif
...
...
@@ -514,11 +523,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
case
SWITCH_STATUS_RESAMPLE
:
write_frame
=
&
session
->
raw_write_frame
;
if
(
!
session
->
write_resampler
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
status
=
switch_resample_create
(
&
session
->
write_resampler
,
frame
->
codec
->
implementation
->
actual_samples_per_second
,
frame
->
codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
write_codec
->
implementation
->
actual_samples_per_second
,
session
->
write_codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
pool
);
switch_mutex_unlock
(
session
->
resample_mutex
);
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
goto
done
;
}
...
...
@@ -538,8 +549,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
return
SWITCH_STATUS_SUCCESS
;
case
SWITCH_STATUS_NOOP
:
if
(
session
->
write_resampler
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
switch_resample_destroy
(
&
session
->
write_resampler
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Deactivating write resampler
\n
"
);
switch_mutex_unlock
(
session
->
resample_mutex
);
}
write_frame
=
frame
;
status
=
SWITCH_STATUS_SUCCESS
;
...
...
@@ -552,6 +565,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if
(
session
->
write_resampler
)
{
short
*
data
=
write_frame
->
data
;
switch_mutex_lock
(
session
->
resample_mutex
);
session
->
write_resampler
->
from_len
=
write_frame
->
datalen
/
2
;
switch_short_to_float
(
data
,
session
->
write_resampler
->
from
,
session
->
write_resampler
->
from_len
);
...
...
@@ -568,6 +583,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
write_frame
->
samples
=
session
->
write_resampler
->
to_len
;
write_frame
->
datalen
=
write_frame
->
samples
*
2
;
write_frame
->
rate
=
session
->
write_resampler
->
to_rate
;
switch_mutex_unlock
(
session
->
resample_mutex
);
}
if
(
session
->
bugs
)
{
...
...
@@ -744,11 +760,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
session
->
enc_write_frame
.
payload
=
session
->
write_codec
->
implementation
->
ianacode
;
write_frame
=
&
session
->
enc_write_frame
;
if
(
!
session
->
read_resampler
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
status
=
switch_resample_create
(
&
session
->
read_resampler
,
frame
->
codec
->
implementation
->
actual_samples_per_second
,
frame
->
codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
write_codec
->
implementation
->
actual_samples_per_second
,
session
->
write_codec
->
implementation
->
bytes_per_frame
*
20
,
session
->
pool
);
switch_mutex_unlock
(
session
->
resample_mutex
);
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
goto
done
;
}
...
...
@@ -766,8 +785,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
break
;
case
SWITCH_STATUS_NOOP
:
if
(
session
->
read_resampler
)
{
switch_mutex_lock
(
session
->
resample_mutex
);
switch_resample_destroy
(
&
session
->
read_resampler
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Deactivating read resampler
\n
"
);
switch_mutex_unlock
(
session
->
resample_mutex
);
}
enc_frame
->
codec
=
session
->
write_codec
;
enc_frame
->
samples
=
enc_frame
->
datalen
/
sizeof
(
int16_t
);
...
...
@@ -788,7 +809,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if
(
session
->
read_resampler
)
{
short
*
data
=
write_frame
->
data
;
switch_mutex_lock
(
session
->
resample_mutex
);
session
->
read_resampler
->
from_len
=
switch_short_to_float
(
data
,
session
->
read_resampler
->
from
,
(
int
)
write_frame
->
datalen
/
2
);
session
->
read_resampler
->
to_len
=
(
uint32_t
)
...
...
@@ -799,6 +821,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
write_frame
->
samples
=
session
->
read_resampler
->
to_len
;
write_frame
->
datalen
=
session
->
read_resampler
->
to_len
*
2
;
write_frame
->
rate
=
session
->
read_resampler
->
to_rate
;
switch_mutex_unlock
(
session
->
resample_mutex
);
}
if
(
flag
&
SFF_CNG
)
{
switch_set_flag
(
write_frame
,
SFF_CNG
);
...
...
src/switch_core_session.c
浏览文件 @
c4832b4b
...
...
@@ -813,6 +813,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch
session
->
enc_read_frame
.
buflen
=
sizeof
(
session
->
enc_read_buf
);
switch_mutex_init
(
&
session
->
mutex
,
SWITCH_MUTEX_NESTED
,
session
->
pool
);
switch_mutex_init
(
&
session
->
resample_mutex
,
SWITCH_MUTEX_NESTED
,
session
->
pool
);
switch_thread_rwlock_create
(
&
session
->
bug_rwlock
,
session
->
pool
);
switch_thread_cond_create
(
&
session
->
cond
,
session
->
pool
);
switch_thread_rwlock_create
(
&
session
->
rwlock
,
session
->
pool
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论