Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
3d7fbd17
提交
3d7fbd17
authored
2月 25, 2016
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8876 #resolve [Bind video threads to CPU alternating]
上级
9314001e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
40 行增加
和
3 行删除
+40
-3
switch_core_media.c
src/switch_core_media.c
+38
-1
switch_vpx.c
src/switch_vpx.c
+2
-2
没有找到文件。
src/switch_core_media.c
浏览文件 @
3d7fbd17
...
...
@@ -66,7 +66,14 @@ typedef struct secure_settings_s {
char
*
remote_crypto_key
;
}
switch_secure_settings_t
;
typedef
struct
core_video_globals_s
{
int
cpu_count
;
int
cur_cpu
;
switch_memory_pool_t
*
pool
;
switch_mutex_t
*
mutex
;
}
core_video_globals_t
;
static
core_video_globals_t
video_globals
=
{
0
};
struct
media_helper
{
switch_core_session_t
*
session
;
...
...
@@ -5008,6 +5015,27 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses
return
SWITCH_STATUS_SUCCESS
;
}
int
next_cpu
(
void
)
{
int
x
=
0
;
switch_mutex_lock
(
video_globals
.
mutex
);
x
=
video_globals
.
cur_cpu
++
;
if
(
video_globals
.
cur_cpu
==
video_globals
.
cpu_count
)
{
video_globals
.
cur_cpu
=
0
;
}
switch_mutex_unlock
(
video_globals
.
mutex
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"Binding to CPU %d
\n
"
,
x
);
return
x
;
}
static
void
bind_cpu
(
void
)
{
switch_core_thread_set_cpu_affinity
(
next_cpu
());
}
static
void
*
SWITCH_THREAD_FUNC
video_helper_thread
(
switch_thread_t
*
thread
,
void
*
obj
)
{
struct
media_helper
*
mh
=
obj
;
...
...
@@ -5029,6 +5057,8 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
return
NULL
;
}
bind_cpu
();
if
((
var
=
switch_channel_get_variable
(
session
->
channel
,
"core_video_blank_image"
)))
{
blank_img
=
switch_img_read_png
(
var
,
SWITCH_IMG_FMT_I420
);
}
...
...
@@ -10283,11 +10313,18 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
SWITCH_DECLARE
(
void
)
switch_core_media_init
(
void
)
{
switch_core_gen_certs
(
DTLS_SRTP_FNAME
".pem"
);
video_globals
.
cpu_count
=
switch_core_cpu_count
();
video_globals
.
cur_cpu
=
0
;
switch_core_new_memory_pool
(
&
video_globals
.
pool
);
switch_mutex_init
(
&
video_globals
.
mutex
,
SWITCH_MUTEX_NESTED
,
video_globals
.
pool
);
}
SWITCH_DECLARE
(
void
)
switch_core_media_deinit
(
void
)
{
switch_core_destroy_memory_pool
(
&
video_globals
.
pool
);
}
static
int
payload_number
(
const
char
*
name
)
...
...
src/switch_vpx.c
浏览文件 @
3d7fbd17
...
...
@@ -304,7 +304,7 @@ static switch_status_t init_decoder(switch_codec_t *codec)
// context->decoder_init = 0;
//}
cfg
.
threads
=
switch_core_cpu_count
()
;
cfg
.
threads
=
1
;
//(switch_core_cpu_count() > 1) ? 2 : 1
;
if
(
!
context
->
is_vp9
)
{
// vp8 only
// dec_flags = VPX_CODEC_USE_POSTPROC;
...
...
@@ -391,7 +391,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
config
->
rc_target_bitrate
=
context
->
bandwidth
;
config
->
g_lag_in_frames
=
0
;
config
->
kf_max_dist
=
2000
;
config
->
g_threads
=
(
cpus
>
1
)
?
2
:
1
;
config
->
g_threads
=
1
;
//
(cpus > 1) ? 2 : 1;
if
(
context
->
is_vp9
)
{
//config->rc_dropframe_thresh = 2;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论