Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f1bede82
提交
f1bede82
authored
6月 13, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@5318
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
a035ec59
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
83 行增加
和
30 行删除
+83
-30
modules.conf.in
build/modules.conf.in
+1
-0
switch_core_pvt.h
src/include/private/switch_core_pvt.h
+4
-2
switch_core.h
src/include/switch_core.h
+15
-2
switch_types.h
src/include/switch_types.h
+5
-2
mod_soundtouch.cpp
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
+2
-2
switch_core_io.c
src/switch_core_io.c
+30
-18
switch_core_media_bug.c
src/switch_core_media_bug.c
+26
-4
没有找到文件。
build/modules.conf.in
浏览文件 @
f1bede82
...
...
@@ -8,6 +8,7 @@ applications/mod_echo
applications/mod_enum
#applications/mod_ivrtest
#applications/mod_park
#applications/mod_soundtouch
applications/mod_playback
#applications/mod_rss
#applications/mod_skel
...
...
src/include/private/switch_core_pvt.h
浏览文件 @
f1bede82
...
...
@@ -127,8 +127,10 @@ struct switch_core_session {
struct
switch_media_bug
{
switch_buffer_t
*
raw_write_buffer
;
switch_buffer_t
*
raw_read_buffer
;
switch_frame_t
*
replace_frame_in
;
switch_frame_t
*
replace_frame_out
;
switch_frame_t
*
read_replace_frame_in
;
switch_frame_t
*
read_replace_frame_out
;
switch_frame_t
*
write_replace_frame_in
;
switch_frame_t
*
write_replace_frame_out
;
switch_media_bug_callback_t
callback
;
switch_mutex_t
*
read_mutex
;
switch_mutex_t
*
write_mutex
;
...
...
src/include/switch_core.h
浏览文件 @
f1bede82
...
...
@@ -142,14 +142,27 @@ SWITCH_DECLARE(void *) switch_core_media_bug_get_user_data(switch_media_bug_t *b
\brief Obtain a replace frame from a media bug
\param bug the bug to get the data from
*/
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_replace_frame
(
switch_media_bug_t
*
bug
);
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_
write_
replace_frame
(
switch_media_bug_t
*
bug
);
/*!
\brief Set a return replace frame
\param bug the bug to set the frame on
\param frame the frame to set
*/
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
);
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_write_replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
);
/*!
\brief Obtain a replace frame from a media bug
\param bug the bug to get the data from
*/
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_read_replace_frame
(
switch_media_bug_t
*
bug
);
/*!
\brief Set a return replace frame
\param bug the bug to set the frame on
\param frame the frame to set
*/
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_read_replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
);
/*!
\brief Remove a media bug from the session
...
...
src/include/switch_types.h
浏览文件 @
f1bede82
...
...
@@ -196,6 +196,7 @@ typedef enum {
SWITCH_ABC_TYPE_READ
,
SWITCH_ABC_TYPE_WRITE
,
SWITCH_ABC_TYPE_WRITE_REPLACE
,
SWITCH_ABC_TYPE_READ_REPLACE
,
SWITCH_ABC_TYPE_CLOSE
}
switch_abc_type_t
;
...
...
@@ -742,14 +743,16 @@ typedef enum {
<pre>
SMBF_READ_STREAM - Include the Read Stream
SMBF_WRITE_STREAM - Include the Write Stream
SMBF_WRITE_STREAM - Replace the Write Stream
SMBF_WRITE_REPLACE - Replace the Write Stream
SMBF_READ_REPLACE - Replace the Read Stream
</pre>
*/
typedef
enum
{
SMBF_BOTH
=
0
,
SMBF_READ_STREAM
=
(
1
<<
0
),
SMBF_WRITE_STREAM
=
(
1
<<
1
),
SMBF_WRITE_REPLACE
=
(
1
<<
2
)
SMBF_WRITE_REPLACE
=
(
1
<<
2
),
SMBF_READ_REPLACE
=
(
1
<<
3
)
}
switch_media_bug_flag_t
;
/*!
...
...
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
浏览文件 @
f1bede82
...
...
@@ -215,7 +215,7 @@ static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_dat
assert
(
sth
!=
NULL
);
assert
(
sth
->
st
!=
NULL
);
frame
=
switch_core_media_bug_get_replace_frame
(
bug
);
frame
=
switch_core_media_bug_get_
write_
replace_frame
(
bug
);
sth
->
st
->
putSamples
((
SAMPLETYPE
*
)
frame
->
data
,
frame
->
samples
);
if
(
sth
->
st
->
numSamples
()
>=
frame
->
samples
*
2
)
{
...
...
@@ -225,7 +225,7 @@ static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_dat
memset
(
frame
->
data
,
0
,
frame
->
datalen
);
}
switch_core_media_bug_set_replace_frame
(
bug
,
frame
);
switch_core_media_bug_set_
write_
replace_frame
(
bug
,
frame
);
}
...
...
src/switch_core_io.c
浏览文件 @
f1bede82
...
...
@@ -225,7 +225,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if
(
session
->
bugs
)
{
switch_media_bug_t
*
bp
,
*
dp
,
*
last
=
NULL
;
switch_bool_t
ok
=
SWITCH_TRUE
;
switch_thread_rwlock_rdlock
(
session
->
bug_rwlock
);
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
if
(
bp
->
ready
&&
switch_test_flag
(
bp
,
SMBF_READ_STREAM
))
{
...
...
@@ -233,23 +233,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_buffer_write
(
bp
->
raw_read_buffer
,
read_frame
->
data
,
read_frame
->
datalen
);
if
(
bp
->
callback
)
{
if
(
bp
->
callback
(
bp
,
bp
->
user_data
,
SWITCH_ABC_TYPE_READ
)
==
SWITCH_FALSE
||
(
bp
->
stop_time
&&
bp
->
stop_time
>=
time
(
NULL
)))
{
bp
->
ready
=
0
;
if
(
last
)
{
last
->
next
=
bp
->
next
;
}
else
{
session
->
bugs
=
bp
->
next
;
}
switch_mutex_unlock
(
bp
->
read_mutex
);
dp
=
bp
;
bp
=
last
;
switch_core_media_bug_close
(
&
dp
);
if
(
!
bp
)
{
break
;
}
continue
;
ok
=
SWITCH_FALSE
;
}
}
switch_mutex_unlock
(
bp
->
read_mutex
);
}
else
if
(
switch_test_flag
(
bp
,
SMBF_READ_REPLACE
))
{
do_bugs
=
0
;
if
(
bp
->
callback
)
{
bp
->
read_replace_frame_in
=
read_frame
;
bp
->
read_replace_frame_out
=
NULL
;
if
((
ok
=
bp
->
callback
(
bp
,
bp
->
user_data
,
SWITCH_ABC_TYPE_READ_REPLACE
))
==
SWITCH_TRUE
)
{
read_frame
=
bp
->
read_replace_frame_out
;
}
}
}
if
(
ok
==
SWITCH_FALSE
)
{
bp
->
ready
=
0
;
if
(
last
)
{
last
->
next
=
bp
->
next
;
}
else
{
session
->
bugs
=
bp
->
next
;
}
dp
=
bp
;
bp
=
last
;
switch_core_media_bug_close
(
&
dp
);
if
(
!
bp
)
{
break
;
}
continue
;
}
last
=
bp
;
}
...
...
@@ -497,10 +509,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
}
else
if
(
switch_test_flag
(
bp
,
SMBF_WRITE_REPLACE
))
{
do_bugs
=
0
;
if
(
bp
->
callback
)
{
bp
->
replace_frame_in
=
write_frame
;
bp
->
replace_frame_out
=
NULL
;
bp
->
write_
replace_frame_in
=
write_frame
;
bp
->
write_
replace_frame_out
=
NULL
;
if
((
ok
=
bp
->
callback
(
bp
,
bp
->
user_data
,
SWITCH_ABC_TYPE_WRITE_REPLACE
))
==
SWITCH_TRUE
)
{
write_frame
=
bp
->
replace_frame_out
;
write_frame
=
bp
->
write_
replace_frame_out
;
}
}
}
...
...
src/switch_core_media_bug.c
浏览文件 @
f1bede82
...
...
@@ -41,14 +41,24 @@ static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
}
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_replace_frame
(
switch_media_bug_t
*
bug
)
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_
write_
replace_frame
(
switch_media_bug_t
*
bug
)
{
return
bug
->
replace_frame_in
;
return
bug
->
write_
replace_frame_in
;
}
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
)
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_
write_
replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
)
{
bug
->
replace_frame_out
=
frame
;
bug
->
write_replace_frame_out
=
frame
;
}
SWITCH_DECLARE
(
switch_frame_t
*
)
switch_core_media_bug_get_read_replace_frame
(
switch_media_bug_t
*
bug
)
{
return
bug
->
read_replace_frame_in
;
}
SWITCH_DECLARE
(
void
)
switch_core_media_bug_set_read_replace_frame
(
switch_media_bug_t
*
bug
,
switch_frame_t
*
frame
)
{
bug
->
read_replace_frame_out
=
frame
;
}
SWITCH_DECLARE
(
void
*
)
switch_core_media_bug_get_user_data
(
switch_media_bug_t
*
bug
)
...
...
@@ -161,6 +171,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
}
if
(
flags
&
SMBF_READ_REPLACE
)
{
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
if
(
switch_test_flag
(
bp
,
SMBF_READ_REPLACE
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Only one bug of this type allowed!
\n
"
);
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
return
SWITCH_STATUS_GENERR
;
}
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
}
if
(
!
(
bug
=
switch_core_session_alloc
(
session
,
sizeof
(
*
bug
))))
{
return
SWITCH_STATUS_MEMERR
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论