Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
c321e67a
提交
c321e67a
authored
7月 06, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor
上级
d239b31d
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
58 行增加
和
55 行删除
+58
-55
switch_loadable_module.h
src/include/switch_loadable_module.h
+1
-1
switch_core_codec.c
src/switch_core_codec.c
+25
-26
switch_core_io.c
src/switch_core_io.c
+12
-4
switch_core_media_bug.c
src/switch_core_media_bug.c
+20
-24
没有找到文件。
src/include/switch_loadable_module.h
浏览文件 @
c321e67a
...
@@ -456,7 +456,7 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po
...
@@ -456,7 +456,7 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po
static
inline
switch_bool_t
switch_core_codec_ready
(
switch_codec_t
*
codec
)
static
inline
switch_bool_t
switch_core_codec_ready
(
switch_codec_t
*
codec
)
{
{
return
(
codec
&&
codec
->
implementation
&&
(
codec
->
flags
&
SWITCH_CODEC_FLAG_READY
)
)
?
SWITCH_TRUE
:
SWITCH_FALSE
;
return
(
codec
&&
(
codec
->
flags
&
SWITCH_CODEC_FLAG_READY
)
&&
codec
->
mutex
&&
codec
->
codec_interface
&&
codec
->
implementation
)
?
SWITCH_TRUE
:
SWITCH_FALSE
;
}
}
...
...
src/switch_core_codec.c
浏览文件 @
c321e67a
...
@@ -47,17 +47,14 @@ SWITCH_DECLARE(void) switch_core_session_unset_read_codec(switch_core_session_t
...
@@ -47,17 +47,14 @@ SWITCH_DECLARE(void) switch_core_session_unset_read_codec(switch_core_session_t
switch_mutex_t
*
mutex
=
NULL
;
switch_mutex_t
*
mutex
=
NULL
;
switch_mutex_lock
(
session
->
codec_read_mutex
);
switch_mutex_lock
(
session
->
codec_read_mutex
);
if
(
session
->
read_codec
)
if
(
session
->
read_codec
)
mutex
=
session
->
read_codec
->
mutex
;
mutex
=
session
->
read_codec
->
mutex
;
if
(
mutex
)
switch_mutex_lock
(
mutex
);
if
(
mutex
)
switch_mutex_lock
(
mutex
);
session
->
real_read_codec
=
session
->
read_codec
=
NULL
;
session
->
real_read_codec
=
session
->
read_codec
=
NULL
;
session
->
raw_read_frame
.
codec
=
session
->
read_codec
;
session
->
raw_read_frame
.
codec
=
session
->
read_codec
;
session
->
raw_write_frame
.
codec
=
session
->
read_codec
;
session
->
raw_write_frame
.
codec
=
session
->
read_codec
;
session
->
enc_read_frame
.
codec
=
session
->
read_codec
;
session
->
enc_read_frame
.
codec
=
session
->
read_codec
;
session
->
enc_write_frame
.
codec
=
session
->
read_codec
;
session
->
enc_write_frame
.
codec
=
session
->
read_codec
;
if
(
mutex
)
if
(
mutex
)
switch_mutex_unlock
(
mutex
);
switch_mutex_unlock
(
mutex
);
switch_mutex_unlock
(
session
->
codec_read_mutex
);
switch_mutex_unlock
(
session
->
codec_read_mutex
);
}
}
...
@@ -86,13 +83,10 @@ SWITCH_DECLARE(void) switch_core_session_unset_write_codec(switch_core_session_t
...
@@ -86,13 +83,10 @@ SWITCH_DECLARE(void) switch_core_session_unset_write_codec(switch_core_session_t
switch_mutex_t
*
mutex
=
NULL
;
switch_mutex_t
*
mutex
=
NULL
;
switch_mutex_lock
(
session
->
codec_write_mutex
);
switch_mutex_lock
(
session
->
codec_write_mutex
);
if
(
session
->
write_codec
)
if
(
session
->
write_codec
)
mutex
=
session
->
write_codec
->
mutex
;
mutex
=
session
->
write_codec
->
mutex
;
if
(
mutex
)
switch_mutex_lock
(
mutex
);
if
(
mutex
)
switch_mutex_lock
(
mutex
);
session
->
real_write_codec
=
session
->
write_codec
=
NULL
;
session
->
real_write_codec
=
session
->
write_codec
=
NULL
;
if
(
mutex
)
if
(
mutex
)
switch_mutex_unlock
(
mutex
);
switch_mutex_unlock
(
mutex
);
switch_mutex_unlock
(
session
->
codec_write_mutex
);
switch_mutex_unlock
(
session
->
codec_write_mutex
);
}
}
...
@@ -495,6 +489,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw
...
@@ -495,6 +489,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw
new_codec
->
implementation
->
init
(
new_codec
,
new_codec
->
flags
,
NULL
);
new_codec
->
implementation
->
init
(
new_codec
,
new_codec
->
flags
,
NULL
);
switch_mutex_init
(
&
new_codec
->
mutex
,
SWITCH_MUTEX_NESTED
,
new_codec
->
memory_pool
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -598,12 +594,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
...
@@ -598,12 +594,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
return
SWITCH_STATUS_NOT_INITALIZED
;
return
SWITCH_STATUS_NOT_INITALIZED
;
}
}
if
(
codec
->
mutex
)
if
(
codec
->
mutex
)
switch_mutex_lock
(
codec
->
mutex
);
switch_mutex_lock
(
codec
->
mutex
);
status
=
codec
->
implementation
->
encode
(
codec
,
other_codec
,
decoded_data
,
decoded_data_len
,
status
=
codec
->
implementation
->
encode
(
codec
,
other_codec
,
decoded_data
,
decoded_data_len
,
decoded_rate
,
encoded_data
,
encoded_data_len
,
encoded_rate
,
flag
);
decoded_rate
,
encoded_data
,
encoded_data_len
,
encoded_rate
,
flag
);
if
(
codec
->
mutex
)
if
(
codec
->
mutex
)
switch_mutex_unlock
(
codec
->
mutex
);
switch_mutex_unlock
(
codec
->
mutex
);
return
status
;
return
status
;
...
@@ -624,6 +618,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
...
@@ -624,6 +618,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
if
(
!
codec
->
implementation
||
!
switch_core_codec_ready
(
codec
))
{
if
(
!
codec
->
implementation
||
!
switch_core_codec_ready
(
codec
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Codec is not initialized!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Codec is not initialized!
\n
"
);
abort
();
return
SWITCH_STATUS_NOT_INITALIZED
;
return
SWITCH_STATUS_NOT_INITALIZED
;
}
}
...
@@ -641,12 +636,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
...
@@ -641,12 +636,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
}
}
}
}
if
(
codec
->
mutex
)
if
(
codec
->
mutex
)
switch_mutex_lock
(
codec
->
mutex
);
switch_mutex_lock
(
codec
->
mutex
);
status
=
codec
->
implementation
->
decode
(
codec
,
other_codec
,
encoded_data
,
encoded_data_len
,
encoded_rate
,
status
=
codec
->
implementation
->
decode
(
codec
,
other_codec
,
encoded_data
,
encoded_data_len
,
encoded_rate
,
decoded_data
,
decoded_data_len
,
decoded_rate
,
flag
);
decoded_data
,
decoded_data_len
,
decoded_rate
,
flag
);
if
(
codec
->
mutex
)
if
(
codec
->
mutex
)
switch_mutex_unlock
(
codec
->
mutex
);
switch_mutex_unlock
(
codec
->
mutex
);
return
status
;
return
status
;
}
}
...
@@ -659,7 +652,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
...
@@ -659,7 +652,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
switch_assert
(
codec
!=
NULL
);
switch_assert
(
codec
!=
NULL
);
if
(
!
codec
->
implementation
||
!
switch_core_codec_ready
(
codec
))
{
if
(
!
switch_core_codec_ready
(
codec
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Codec is not initialized!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Codec is not initialized!
\n
"
);
return
SWITCH_STATUS_NOT_INITALIZED
;
return
SWITCH_STATUS_NOT_INITALIZED
;
}
}
...
@@ -671,21 +664,27 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
...
@@ -671,21 +664,27 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
pool
=
codec
->
memory_pool
;
pool
=
codec
->
memory_pool
;
mutex
=
codec
->
mutex
;
mutex
=
codec
->
mutex
;
if
(
mutex
)
if
(
mutex
)
{
switch_mutex_lock
(
mutex
);
switch_clear_flag
(
codec
,
SWITCH_CODEC_FLAG_READY
);
switch_mutex_unlock
(
mutex
);
switch_mutex_lock
(
mutex
);
switch_mutex_lock
(
mutex
);
}
codec
->
implementation
->
destroy
(
codec
);
codec
->
implementation
->
destroy
(
codec
);
switch_clear_flag
(
codec
,
SWITCH_CODEC_FLAG_READY
);
UNPROTECT_INTERFACE
(
codec
->
codec_interface
);
UNPROTECT_INTERFACE
(
codec
->
codec_interface
);
if
(
mutex
)
if
(
mutex
)
{
switch_mutex_unlock
(
mutex
);
switch_mutex_unlock
(
mutex
);
}
if
(
free_pool
)
{
if
(
free_pool
)
{
switch_core_destroy_memory_pool
(
&
pool
);
switch_core_destroy_memory_pool
(
&
pool
);
}
}
memset
(
codec
,
0
,
sizeof
(
*
codec
));
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
...
src/switch_core_io.c
浏览文件 @
c321e67a
...
@@ -127,7 +127,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
...
@@ -127,7 +127,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
top
:
top
:
if
(
switch_channel_down
(
session
->
channel
))
{
if
(
switch_channel_down
(
session
->
channel
)
||
!
switch_core_codec_ready
(
session
->
read_codec
)
)
{
*
frame
=
NULL
;
*
frame
=
NULL
;
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
goto
even_more_done
;
goto
even_more_done
;
...
@@ -170,13 +170,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
...
@@ -170,13 +170,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
}
}
}
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
)
||
!
session
->
read_codec
||
!
s
ession
->
read_codec
->
mutex
)
{
if
(
!
SWITCH_READ_ACCEPTABLE
(
status
)
||
!
session
->
read_codec
||
!
s
witch_core_codec_ready
(
session
->
read_codec
)
)
{
*
frame
=
NULL
;
*
frame
=
NULL
;
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
switch_mutex_lock
(
session
->
codec_read_mutex
);
switch_mutex_lock
(
session
->
codec_read_mutex
);
switch_mutex_lock
(
session
->
read_codec
->
mutex
);
switch_mutex_lock
(
session
->
read_codec
->
mutex
);
if
(
!
switch_core_codec_ready
(
session
->
read_codec
))
{
*
frame
=
NULL
;
status
=
SWITCH_STATUS_FALSE
;
goto
even_more_done
;
}
}
}
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
...
@@ -273,10 +279,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
...
@@ -273,10 +279,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
else
{
}
else
{
switch_codec_t
*
use_codec
=
read_frame
->
codec
;
switch_codec_t
*
use_codec
=
read_frame
->
codec
;
if
(
do_bugs
)
{
if
(
do_bugs
)
{
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
if
(
!
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
if
(
!
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_copy
(
read_frame
->
codec
,
&
session
->
bug_codec
,
NULL
);
switch_core_codec_copy
(
read_frame
->
codec
,
&
session
->
bug_codec
,
NULL
);
}
}
use_codec
=
&
session
->
bug_codec
;
use_codec
=
&
session
->
bug_codec
;
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
}
}
status
=
switch_core_codec_decode
(
use_codec
,
status
=
switch_core_codec_decode
(
use_codec
,
...
@@ -630,7 +638,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
...
@@ -630,7 +638,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
switch_mutex_lock
(
session
->
codec_write_mutex
);
switch_mutex_lock
(
session
->
codec_write_mutex
);
if
(
!
(
s
ession
->
write_codec
&&
session
->
write_codec
->
mutex
&&
frame
->
codec
)
||
if
(
!
(
s
witch_core_codec_ready
(
session
->
write_codec
)
&&
frame
->
codec
)
||
!
switch_channel_ready
(
session
->
channel
)
||
!
switch_channel_media_ready
(
session
->
channel
))
{
!
switch_channel_ready
(
session
->
channel
)
||
!
switch_channel_media_ready
(
session
->
channel
))
{
switch_mutex_unlock
(
session
->
codec_write_mutex
);
switch_mutex_unlock
(
session
->
codec_write_mutex
);
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
...
@@ -639,7 +647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
...
@@ -639,7 +647,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
switch_mutex_lock
(
session
->
write_codec
->
mutex
);
switch_mutex_lock
(
session
->
write_codec
->
mutex
);
switch_mutex_lock
(
frame
->
codec
->
mutex
);
switch_mutex_lock
(
frame
->
codec
->
mutex
);
if
(
!
frame
->
codec
->
implementation
||
!
session
->
write_codec
->
implementation
)
goto
error
;
if
(
!
(
switch_core_codec_ready
(
session
->
write_codec
)
&&
switch_core_codec_ready
(
frame
->
codec
))
)
goto
error
;
if
((
session
->
write_codec
&&
frame
->
codec
&&
session
->
write_codec
->
implementation
!=
frame
->
codec
->
implementation
))
{
if
((
session
->
write_codec
&&
frame
->
codec
&&
session
->
write_codec
->
implementation
!=
frame
->
codec
->
implementation
))
{
if
(
session
->
write_impl
.
codec_id
==
frame
->
codec
->
implementation
->
codec_id
||
if
(
session
->
write_impl
.
codec_id
==
frame
->
codec
->
implementation
->
codec_id
||
...
...
src/switch_core_media_bug.c
浏览文件 @
c321e67a
...
@@ -47,11 +47,6 @@ static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
...
@@ -47,11 +47,6 @@ static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
switch_buffer_destroy
(
&
bug
->
raw_write_buffer
);
switch_buffer_destroy
(
&
bug
->
raw_write_buffer
);
}
}
if
(
switch_core_codec_ready
(
&
bug
->
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
bug
->
session
->
bug_codec
);
memset
(
&
bug
->
session
->
bug_codec
,
0
,
sizeof
(
bug
->
session
->
bug_codec
));
}
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MEDIA_BUG_STOP
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MEDIA_BUG_STOP
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Media-Bug-Function"
,
"%s"
,
bug
->
function
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Media-Bug-Function"
,
"%s"
,
bug
->
function
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Media-Bug-Target"
,
"%s"
,
bug
->
target
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Media-Bug-Target"
,
"%s"
,
bug
->
target
);
...
@@ -424,7 +419,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_ses
...
@@ -424,7 +419,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_ses
if
(
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
if
(
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
session
->
bug_codec
);
switch_core_codec_destroy
(
&
session
->
bug_codec
);
memset
(
&
session
->
bug_codec
,
0
,
sizeof
(
session
->
bug_codec
));
}
}
return
status
;
return
status
;
...
@@ -458,8 +452,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
...
@@ -458,8 +452,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
switch_media_bug_t
*
bp
=
NULL
,
*
last
=
NULL
;
switch_media_bug_t
*
bp
=
NULL
,
*
last
=
NULL
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
if
(
session
->
bugs
)
{
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
if
(
session
->
bugs
)
{
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
if
((
!
bp
->
thread_id
||
bp
->
thread_id
==
switch_thread_self
())
&&
bp
->
ready
&&
bp
==
*
bug
)
{
if
((
!
bp
->
thread_id
||
bp
->
thread_id
==
switch_thread_self
())
&&
bp
->
ready
&&
bp
==
*
bug
)
{
if
(
last
)
{
if
(
last
)
{
...
@@ -472,15 +466,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
...
@@ -472,15 +466,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
last
=
bp
;
last
=
bp
;
}
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
if
(
bp
)
{
status
=
switch_core_media_bug_close
(
&
bp
);
}
}
}
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
session
->
bug_codec
);
switch_core_codec_destroy
(
&
session
->
bug_codec
);
memset
(
&
session
->
bug_codec
,
0
,
sizeof
(
session
->
bug_codec
));
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
if
(
bp
)
{
status
=
switch_core_media_bug_close
(
&
bp
);
}
}
return
status
;
return
status
;
...
@@ -496,8 +491,8 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
...
@@ -496,8 +491,8 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
top
:
top
:
if
(
session
->
bugs
)
{
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
if
(
session
->
bugs
)
{
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
for
(
bp
=
session
->
bugs
;
bp
;
bp
=
bp
->
next
)
{
if
(
switch_core_media_bug_test_flag
(
bp
,
SMBF_PRUNE
))
{
if
(
switch_core_media_bug_test_flag
(
bp
,
SMBF_PRUNE
))
{
if
(
last
)
{
if
(
last
)
{
...
@@ -510,18 +505,19 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
...
@@ -510,18 +505,19 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess
last
=
bp
;
last
=
bp
;
}
}
}
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
session
->
bug_codec
);
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
if
(
bp
)
{
if
(
bp
)
{
status
=
switch_core_media_bug_close
(
&
bp
);
status
=
switch_core_media_bug_close
(
&
bp
);
ttl
++
;
ttl
++
;
goto
top
;
goto
top
;
}
}
}
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
session
->
bug_codec
);
memset
(
&
session
->
bug_codec
,
0
,
sizeof
(
session
->
bug_codec
));
}
return
ttl
;
return
ttl
;
}
}
...
@@ -532,9 +528,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_cor
...
@@ -532,9 +528,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_cor
switch_media_bug_t
*
cur
=
NULL
,
*
bp
=
NULL
,
*
last
=
NULL
;
switch_media_bug_t
*
cur
=
NULL
,
*
bp
=
NULL
,
*
last
=
NULL
;
int
total
=
0
;
int
total
=
0
;
if
(
session
->
bugs
)
{
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
switch_thread_rwlock_wrlock
(
session
->
bug_rwlock
);
if
(
session
->
bugs
)
{
bp
=
session
->
bugs
;
bp
=
session
->
bugs
;
while
(
bp
)
{
while
(
bp
)
{
cur
=
bp
;
cur
=
bp
;
...
@@ -553,14 +548,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_cor
...
@@ -553,14 +548,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_callback(switch_cor
last
=
cur
;
last
=
cur
;
}
}
}
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
}
}
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
if
(
!
session
->
bugs
&&
switch_core_codec_ready
(
&
session
->
bug_codec
))
{
switch_core_codec_destroy
(
&
session
->
bug_codec
);
switch_core_codec_destroy
(
&
session
->
bug_codec
);
memset
(
&
session
->
bug_codec
,
0
,
sizeof
(
session
->
bug_codec
));
}
}
switch_thread_rwlock_unlock
(
session
->
bug_rwlock
);
return
total
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_FALSE
;
return
total
?
SWITCH_STATUS_SUCCESS
:
SWITCH_STATUS_FALSE
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论