Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
0fcf13bc
提交
0fcf13bc
authored
9月 14, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
misc
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@2704
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
c79cd67d
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
60 行增加
和
34 行删除
+60
-34
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+10
-3
mod_g711.c
src/mod/codecs/mod_g711/mod_g711.c
+3
-2
mod_exosip.c
src/mod/endpoints/mod_exosip/mod_exosip.c
+1
-1
mod_threadtimer.c
src/mod/timers/mod_threadtimer/mod_threadtimer.c
+44
-27
switch.c
src/switch.c
+1
-1
switch_core.c
src/switch_core.c
+1
-0
没有找到文件。
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
0fcf13bc
...
...
@@ -709,6 +709,10 @@ static void conference_loop(conference_member_t *member)
write_frame
.
data
=
data
;
write_frame
.
buflen
=
sizeof
(
data
);
write_frame
.
codec
=
&
member
->
write_codec
;
if
(
switch_test_flag
(
member
->
conference
,
CFLAG_ANSWERED
))
{
switch_channel_answer
(
channel
);
}
/* Start a thread to read data and feed it into the buffer and use this thread to generate output */
launch_input_thread
(
member
,
switch_core_session_get_pool
(
member
->
session
));
...
...
@@ -957,7 +961,7 @@ static void conference_loop(conference_member_t *member)
}
}
}
/* Rinse ... Repeat */
switch_clear_flag_locked
(
member
,
MFLAG_RUNNING
);
switch_core_timer_destroy
(
&
timer
);
...
...
@@ -2344,9 +2348,12 @@ static void conference_function(switch_core_session_t *session, char *data)
if
(
conference_outcall
(
conference
,
session
,
bridgeto
,
60
,
NULL
,
NULL
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
goto
done
;
}
}
//else
}
else
{
// if we're not using "bridge:" set the conference answered flag
//switch_set_flag(conference, CFLAG_ANSWERED);
// and this isn't an outbound channel, answer the call
if
(
!
switch_channel_test_flag
(
channel
,
CF_OUTBOUND
))
switch_set_flag
(
conference
,
CFLAG_ANSWERED
);
}
...
...
src/mod/codecs/mod_g711/mod_g711.c
浏览文件 @
0fcf13bc
...
...
@@ -187,7 +187,7 @@ static switch_status_t switch_g711a_destroy(switch_codec_t *codec)
/* Registration */
#if 0
static
const
switch_codec_implementation_t
g711u_8k_60ms_implementation
=
{
/*.codec_type */
SWITCH_CODEC_TYPE_AUDIO
,
...
...
@@ -208,7 +208,7 @@ static const switch_codec_implementation_t g711u_8k_60ms_implementation = {
/*.destroy */
switch_g711u_destroy
};
#if 0
static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
/*.ianacode */ 0,
...
...
@@ -268,6 +268,7 @@ static const switch_codec_implementation_t g711u_8k_implementation = {
/*.decode */
switch_g711u_decode
,
/*.destroy */
switch_g711u_destroy
,
///*.next */ &g711u_16k_implementation
&
g711u_8k_60ms_implementation
};
...
...
src/mod/endpoints/mod_exosip/mod_exosip.c
浏览文件 @
0fcf13bc
...
...
@@ -585,7 +585,7 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
ms
,
flags
,
key
,
"soft"
,
"
thread_
soft"
,
&
err
,
switch_core_session_get_pool
(
tech_pvt
->
session
));
if
(
switch_rtp_ready
(
tech_pvt
->
rtp_session
))
{
...
...
src/mod/timers/mod_threadtimer/mod_threadtimer.c
浏览文件 @
0fcf13bc
...
...
@@ -37,16 +37,18 @@ static switch_memory_pool_t *module_pool = NULL;
static
struct
{
int32_t
RUNNING
;
switch_mutex_t
*
mutex
;
uint32_t
timer_milliseconds
;
uint32_t
timer_microseconds
;
}
globals
;
static
const
char
modname
[]
=
"mod_threadtimer"
;
#define MAX_ELEMENTS 1000
struct
timer_private
{
uint
32
_t
tick
;
uint
32
_t
reference
;
uint
64
_t
tick
;
uint
64
_t
reference
;
uint32_t
interval
;
switch_mutex_t
*
mutex
;
//
switch_mutex_t *mutex;
struct
timer_private
*
next
;
};
...
...
@@ -60,11 +62,30 @@ typedef struct timer_head timer_head_t;
static
timer_head_t
*
TIMER_MATRIX
[
MAX_ELEMENTS
+
1
];
#define IDLE_SPEED 100
static
inline
void
set_timer
(
void
)
{
uint32_t
index
=
0
,
min
=
IDLE_SPEED
;
for
(
index
=
0
;
index
<
MAX_ELEMENTS
;
index
++
)
{
if
(
TIMER_MATRIX
[
index
]
&&
TIMER_MATRIX
[
index
]
->
private_info
)
{
if
(
min
>
index
)
{
min
=
index
;
}
}
}
globals
.
timer_milliseconds
=
min
;
globals
.
timer_microseconds
=
min
*
1000
;
}
static
inline
switch_status_t
timer_init
(
switch_timer_t
*
timer
)
{
timer_private_t
*
private_info
;
timer_head_t
*
head
;
if
((
private_info
=
switch_core_alloc
(
timer
->
memory_pool
,
sizeof
(
*
private_info
))))
{
timer
->
private_info
=
private_info
;
if
(
!
TIMER_MATRIX
[
timer
->
interval
])
{
...
...
@@ -76,35 +97,28 @@ static inline switch_status_t timer_init(switch_timer_t *timer)
head
=
TIMER_MATRIX
[
timer
->
interval
];
switch_mutex_init
(
&
private_info
->
mutex
,
SWITCH_MUTEX_NESTED
,
timer
->
memory_pool
);
//
switch_mutex_init(&private_info->mutex, SWITCH_MUTEX_NESTED, timer->memory_pool);
private_info
->
interval
=
timer
->
interval
;
switch_mutex_lock
(
head
->
mutex
);
private_info
->
next
=
head
->
private_info
;
head
->
private_info
=
private_info
;
switch_mutex_unlock
(
head
->
mutex
);
set_timer
();
return
SWITCH_STATUS_SUCCESS
;
}
return
SWITCH_STATUS_MEMERR
;
}
#define MAX_TICKS 0xFFFFFF00
#define check_overflow(p) if (p->reference > MAX_TICKS) {\
switch_mutex_lock(p->mutex);\
p->reference = p->tick = 0;\
switch_mutex_unlock(p->mutex);\
}\
static
inline
switch_status_t
timer_step
(
switch_timer_t
*
timer
)
{
timer_private_t
*
private_info
=
timer
->
private_info
;
switch_mutex_lock
(
private_info
->
mutex
);
//
switch_mutex_lock(private_info->mutex);
private_info
->
reference
+=
private_info
->
interval
;
switch_mutex_unlock
(
private_info
->
mutex
);
//
switch_mutex_unlock(private_info->mutex);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -119,7 +133,6 @@ static inline switch_status_t timer_next(switch_timer_t *timer)
while
(
private_info
->
tick
<
private_info
->
reference
)
{
switch_yield
(
1000
);
}
check_overflow
(
private_info
);
timer
->
samplecount
+=
timer
->
samples
;
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -131,15 +144,14 @@ static inline switch_status_t timer_check(switch_timer_t *timer)
timer_private_t
*
private_info
=
timer
->
private_info
;
switch_status_t
status
;
switch_mutex_lock
(
private_info
->
mutex
);
//
switch_mutex_lock(private_info->mutex);
if
(
private_info
->
tick
<
private_info
->
reference
)
{
status
=
SWITCH_STATUS_FALSE
;
}
else
{
private_info
->
reference
+=
private_info
->
interval
;
check_overflow
(
private_info
);
status
=
SWITCH_STATUS_SUCCESS
;
}
switch_mutex_unlock
(
private_info
->
mutex
);
//
switch_mutex_unlock(private_info->mutex);
return
status
;
}
...
...
@@ -167,7 +179,7 @@ static inline switch_status_t timer_destroy(switch_timer_t *timer)
last
=
ptr
;
}
switch_mutex_unlock
(
head
->
mutex
);
set_timer
();
timer
->
private_info
=
NULL
;
return
SWITCH_STATUS_SUCCESS
;
}
...
...
@@ -205,6 +217,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_MOD_DECLARE
(
switch_status_t
)
switch_module_runtime
(
void
)
{
switch_time_t
reference
=
switch_time_now
();
...
...
@@ -214,19 +228,22 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
memset
(
&
globals
,
0
,
sizeof
(
globals
));
switch_mutex_init
(
&
globals
.
mutex
,
SWITCH_MUTEX_NESTED
,
module_pool
);
globals
.
timer_microseconds
=
IDLE_SPEED
*
1000
;
globals
.
timer_milliseconds
=
IDLE_SPEED
;
globals
.
RUNNING
=
1
;
while
(
globals
.
RUNNING
==
1
)
{
reference
+=
1000
;
reference
+=
globals
.
timer_microseconds
;
//printf("TEST %d\n", globals.timer_microseconds);
while
(
switch_time_now
()
<
reference
)
{
switch_yield
(
500
);
//switch_yield((reference - now) - 1000);
switch_yield
(
globals
.
timer_microseconds
>>
1
);
}
current_ms
++
;
current_ms
+=
globals
.
timer_milliseconds
;
for
(
x
=
0
;
x
<
1000
;
x
++
)
{
for
(
x
=
0
;
x
<
MAX_ELEMENTS
;
x
++
)
{
int
i
=
x
,
index
;
if
(
i
==
0
)
{
i
=
1
;
...
...
@@ -237,9 +254,9 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
if
(
TIMER_MATRIX
[
index
]
&&
TIMER_MATRIX
[
index
]
->
private_info
)
{
switch_mutex_lock
(
TIMER_MATRIX
[
index
]
->
mutex
);
for
(
ptr
=
TIMER_MATRIX
[
index
]
->
private_info
;
ptr
;
ptr
=
ptr
->
next
)
{
switch_mutex_lock
(
ptr
->
mutex
);
//
switch_mutex_lock(ptr->mutex);
ptr
->
tick
+=
ptr
->
interval
;
switch_mutex_unlock
(
ptr
->
mutex
);
//
switch_mutex_unlock(ptr->mutex);
}
switch_mutex_unlock
(
TIMER_MATRIX
[
index
]
->
mutex
);
}
...
...
src/switch.c
浏览文件 @
0fcf13bc
...
...
@@ -62,7 +62,7 @@ static void set_high_priority()
#ifdef WIN32
SetPriorityClass
(
GetCurrentProcess
(),
HIGH_PRIORITY_CLASS
);
#else
//nice(-
20
);
//nice(-
19
);
#endif
}
...
...
src/switch_core.c
浏览文件 @
0fcf13bc
...
...
@@ -3624,6 +3624,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(char *console, cons
switch_event_fire
(
&
event
);
}
//#define USE_MLOCKALL
#ifdef HAVE_MLOCKALL
#ifdef USE_MLOCKALL
mlockall
(
MCL_CURRENT
|
MCL_FUTURE
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论