Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
0ad867f3
提交
0ad867f3
authored
6月 14, 2018
作者:
Seven Du
提交者:
Muteesa Fred
7月 24, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11189 make rtp-slice-size and key-frame-min-freq configurable
上级
e19687e0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
28 行增加
和
2 行删除
+28
-2
vpx.conf.xml
conf/vanilla/autoload_configs/vpx.conf.xml
+5
-0
switch_vpx.c
src/switch_vpx.c
+23
-2
没有找到文件。
conf/vanilla/autoload_configs/vpx.conf.xml
浏览文件 @
0ad867f3
...
...
@@ -3,6 +3,11 @@
<!-- max bitrate the system support, truncate if over limit -->
<!-- <param name="max-bitrate" value="5mb"/> -->
<!-- <param name="rtp-slice-size" value="1200"/> -->
<!-- minimum time to generate a new key frame in ms /> -->
<!-- <param name="key-frame-min-freq" value="250"/> -->
<!-- integer of cpus, or 'auto', or 'cpu/<divisor>/<max> -->
<param
name=
"dec-threads"
value=
"cpu/2/4"
/>
<param
name=
"enc-threads"
value=
"1"
/>
...
...
src/switch_vpx.c
浏览文件 @
0ad867f3
...
...
@@ -380,6 +380,9 @@ typedef struct vpx_context vpx_context_t;
struct
vpx_globals
{
int
debug
;
uint32_t
max_bitrate
;
uint32_t
rtp_slice_size
;
uint32_t
key_frame_min_freq
;
char
vp8_profile
[
20
];
char
vp9_profile
[
20
];
char
vp10_profile
[
20
];
...
...
@@ -651,7 +654,7 @@ static switch_status_t consume_partition(vpx_context_t *context, switch_frame_t
// if !extended
hdrlen
=
1
;
body
=
((
uint8_t
*
)
frame
->
data
)
+
hdrlen
;
packet_size
=
SLICE_SIZE
;
packet_size
=
vpx_globals
.
rtp_slice_size
;
payload_size
=
packet_size
-
hdrlen
;
// else add extended TBD
...
...
@@ -820,7 +823,7 @@ static switch_status_t switch_vpx_encode(switch_codec_t *codec, switch_frame_t *
if
(
context
->
need_key_frame
>
0
)
{
// force generate a key frame
if
(
!
context
->
last_key_frame
||
(
now
-
context
->
last_key_frame
)
>
KEY_FRAME_MIN_FREQ
)
{
if
(
!
context
->
last_key_frame
||
(
now
-
context
->
last_key_frame
)
>
vpx_globals
.
key_frame_min_freq
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG1
,
"VPX KEYFRAME GENERATED
\n
"
);
vpx_flags
|=
VPX_EFLAG_FORCE_KF
;
context
->
need_key_frame
=
0
;
...
...
@@ -1406,6 +1409,13 @@ static void load_config()
if
(
!
strcmp
(
name
,
"max-bitrate"
))
{
vpx_globals
.
max_bitrate
=
switch_parse_bandwidth_string
(
value
);
}
else
if
(
!
strcmp
(
name
,
"rtp-slice-size"
))
{
int
val
=
atoi
(
value
);
vpx_globals
.
rtp_slice_size
=
UINTVAL
(
val
);
}
else
if
(
!
strcmp
(
name
,
"key-frame-min-freq"
))
{
int
val
=
atoi
(
value
);
vpx_globals
.
key_frame_min_freq
=
UINTVAL
(
val
);
vpx_globals
.
key_frame_min_freq
*=
1000
;
}
else
if
(
!
strcmp
(
name
,
"dec-threads"
))
{
vpx_globals
.
vp8
.
dec_cfg
.
threads
=
switch_parse_cpu_string
(
value
);
vpx_globals
.
vp9
.
dec_cfg
.
threads
=
switch_parse_cpu_string
(
value
);
...
...
@@ -1634,6 +1644,14 @@ static void load_config()
vpx_globals
.
max_bitrate
=
switch_calc_bitrate
(
1920
,
1080
,
5
,
60
);
}
if
(
vpx_globals
.
rtp_slice_size
<
500
||
vpx_globals
.
rtp_slice_size
>
1500
)
{
vpx_globals
.
rtp_slice_size
=
SLICE_SIZE
;
}
if
(
vpx_globals
.
key_frame_min_freq
<
10000
||
vpx_globals
.
key_frame_min_freq
>
3
*
1000000
)
{
vpx_globals
.
key_frame_min_freq
=
KEY_FRAME_MIN_FREQ
;
}
if
(
!
vpx_globals
.
vp8
.
enc_cfg
.
g_threads
)
vpx_globals
.
vp8
.
enc_cfg
.
g_threads
=
1
;
if
(
!
vpx_globals
.
vp8
.
dec_cfg
.
threads
)
vpx_globals
.
vp8
.
dec_cfg
.
threads
=
switch_parse_cpu_string
(
"cpu/2/4"
);
if
(
!
vpx_globals
.
vp9
.
enc_cfg
.
g_threads
)
vpx_globals
.
vp9
.
enc_cfg
.
g_threads
=
vpx_globals
.
vp8
.
enc_cfg
.
g_threads
;
...
...
@@ -1661,6 +1679,9 @@ SWITCH_STANDARD_API(vpx_api_function)
load_config
();
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" %-26s = %d
\n
"
,
"rtp-slice-size"
,
vpx_globals
.
rtp_slice_size
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" %-26s = %d
\n
"
,
"key-frame-min-freq"
,
vpx_globals
.
key_frame_min_freq
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" %-26s = %d
\n
"
,
"vp8-dec-threads"
,
vpx_globals
.
vp8
.
dec_cfg
.
threads
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" %-26s = %d
\n
"
,
"vp9-dec-threads"
,
vpx_globals
.
vp9
.
dec_cfg
.
threads
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
" %-26s = %d
\n
"
,
"vp10-dec-threads"
,
vpx_globals
.
vp10
.
dec_cfg
.
threads
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论